Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(688)

Unified Diff: skia/ext/bitmap_platform_device_mac.cc

Issue 3227007: Move BitmapPlatformDevice::makeOpaque into a shared file (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « skia/ext/bitmap_platform_device_mac.h ('k') | skia/ext/bitmap_platform_device_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/bitmap_platform_device_mac.cc
diff --git a/skia/ext/bitmap_platform_device_mac.cc b/skia/ext/bitmap_platform_device_mac.cc
index afb02e798904c34279954677f01d0ae9b2846b26..841c75a84d52d413a9e631ed9066f835230db851 100644
--- a/skia/ext/bitmap_platform_device_mac.cc
+++ b/skia/ext/bitmap_platform_device_mac.cc
@@ -19,33 +19,6 @@ namespace skia {
namespace {
-// Constrains position and size to fit within available_size. If |size| is -1,
-// all the |available_size| is used. Returns false if the position is out of
-// |available_size|.
-bool Constrain(int available_size, int* position, int *size) {
- if (*size < -2)
- return false;
-
- if (*position < 0) {
- if (*size != -1)
- *size += *position;
- *position = 0;
- }
- if (*size == 0 || *position >= available_size)
- return false;
-
- if (*size > 0) {
- int overflow = (*position + *size) - available_size;
- if (overflow > 0) {
- *size -= overflow;
- }
- } else {
- // Fill up available size.
- *size = available_size - *position;
- }
- return true;
-}
-
static CGContextRef CGContextForData(void* data, int width, int height) {
#define HAS_ARGB_SHIFTS(a, r, g, b) \
(SK_A32_SHIFT == (a) && SK_R32_SHIFT == (r) \
@@ -279,26 +252,4 @@ void BitmapPlatformDevice::onAccessBitmap(SkBitmap*) {
// Not needed in CoreGraphics
}
-void BitmapPlatformDevice::processPixels(int x, int y,
- int width, int height,
- adjustAlpha adjustor) {
- const SkBitmap& bitmap = accessBitmap(true);
- const SkMatrix& matrix = data_->transform();
- int bitmap_start_x = SkScalarRound(matrix.getTranslateX()) + x;
- int bitmap_start_y = SkScalarRound(matrix.getTranslateY()) + y;
-
- SkAutoLockPixels lock(bitmap);
- if (Constrain(bitmap.width(), &bitmap_start_x, &width) &&
- Constrain(bitmap.height(), &bitmap_start_y, &height)) {
- uint32_t* data = bitmap.getAddr32(0, 0);
- size_t row_words = bitmap.rowBytes() / 4;
- for (int i = 0; i < height; i++) {
- size_t offset = (i + bitmap_start_y) * row_words + bitmap_start_x;
- for (int j = 0; j < width; j++) {
- adjustor(data + offset + j);
- }
- }
- }
-}
-
} // namespace skia
« no previous file with comments | « skia/ext/bitmap_platform_device_mac.h ('k') | skia/ext/bitmap_platform_device_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698