Remove UNSAFE_TODO() in CFGAS_GEGraphics::FillPathWithShading()
There's already a lot of branching, multiplication, function calls,
etc. per pixel, so using span indexing is not likely to be an issue.
Bug: 42271176
Change-Id: Iac528fe38189bc555d3cb8297a95479163bf0188
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/122853
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@google.com>
diff --git a/xfa/fgas/graphics/cfgas_gegraphics.cpp b/xfa/fgas/graphics/cfgas_gegraphics.cpp
index feb648c..64cc5d4 100644
--- a/xfa/fgas/graphics/cfgas_gegraphics.cpp
+++ b/xfa/fgas/graphics/cfgas_gegraphics.cpp
@@ -14,7 +14,6 @@
#include <utility>
#include "core/fxcrt/check.h"
-#include "core/fxcrt/compiler_specific.h"
#include "core/fxcrt/fx_system.h"
#include "core/fxcrt/span_util.h"
#include "core/fxcrt/stl_util.h"
@@ -305,7 +304,7 @@
float y_span = end_y - start_y;
float axis_len_square = (x_span * x_span) + (y_span * y_span);
for (int32_t row = 0; row < height; row++) {
- uint32_t* dib_buf = bmp->GetWritableScanlineAs<uint32_t>(row).data();
+ auto dib_buf = bmp->GetWritableScanlineAs<uint32_t>(row);
for (int32_t column = 0; column < width; column++) {
float scale = 0.0f;
if (axis_len_square) {
@@ -323,8 +322,7 @@
scale = 1.0f;
}
}
- UNSAFE_TODO(dib_buf[column]) =
- m_info.fillColor.GetShading()->GetArgb(scale);
+ dib_buf[column] = m_info.fillColor.GetShading()->GetArgb(scale);
}
}
result = true;
@@ -337,7 +335,7 @@
((start_y - end_y) * (start_y - end_y)) -
((start_r - end_r) * (start_r - end_r));
for (int32_t row = 0; row < height; row++) {
- uint32_t* dib_buf = bmp->GetWritableScanlineAs<uint32_t>(row).data();
+ auto dib_buf = bmp->GetWritableScanlineAs<uint32_t>(row);
for (int32_t column = 0; column < width; column++) {
float x = (float)(column);
float y = (float)(row);
@@ -383,8 +381,7 @@
continue;
s = 1.0f;
}
- UNSAFE_TODO(dib_buf[column]) =
- m_info.fillColor.GetShading()->GetArgb(s);
+ dib_buf[column] = m_info.fillColor.GetShading()->GetArgb(s);
}
}
result = true;