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

Side by Side Diff: skia/ext/bitmap_platform_device.cc

Issue 7019013: Removal of dependencies on PlatformDevice classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Syncing merge conflicts. Created 9 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « printing/printing_context_win.cc ('k') | skia/ext/bitmap_platform_device_linux.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "skia/ext/bitmap_platform_device.h" 5 #include "skia/ext/bitmap_platform_device.h"
6 6
7 #include "skia/ext/bitmap_platform_device_data.h" 7 #include "skia/ext/bitmap_platform_device_data.h"
8 #include "third_party/skia/include/core/SkUtils.h" 8 #include "third_party/skia/include/core/SkUtils.h"
9 9
10 namespace { 10 namespace {
(...skipping 22 matching lines...) Expand all
33 // Fill up available size. 33 // Fill up available size.
34 *size = available_size - *position; 34 *size = available_size - *position;
35 } 35 }
36 return true; 36 return true;
37 } 37 }
38 38
39 } // namespace 39 } // namespace
40 40
41 namespace skia { 41 namespace skia {
42 42
43 void BitmapPlatformDevice::makeOpaque(int x, int y, int width, int height) { 43 void BitmapPlatformDevice::MakeOpaque(int x, int y, int width, int height) {
44 const SkBitmap& bitmap = accessBitmap(true); 44 const SkBitmap& bitmap = accessBitmap(true);
45 SkASSERT(bitmap.config() == SkBitmap::kARGB_8888_Config); 45 SkASSERT(bitmap.config() == SkBitmap::kARGB_8888_Config);
46 46
47 // FIXME(brettw): This is kind of lame, we shouldn't be dealing with 47 // FIXME(brettw): This is kind of lame, we shouldn't be dealing with
48 // transforms at this level. Probably there should be a PlatformCanvas 48 // transforms at this level. Probably there should be a PlatformCanvas
49 // function that does the transform (using the actual transform not just the 49 // function that does the transform (using the actual transform not just the
50 // translation) and calls us with the transformed rect. 50 // translation) and calls us with the transformed rect.
51 const SkMatrix& matrix = data_->transform(); 51 const SkMatrix& matrix = data_->transform();
52 int bitmap_start_x = SkScalarRound(matrix.getTranslateX()) + x; 52 int bitmap_start_x = SkScalarRound(matrix.getTranslateX()) + x;
53 int bitmap_start_y = SkScalarRound(matrix.getTranslateY()) + y; 53 int bitmap_start_y = SkScalarRound(matrix.getTranslateY()) + y;
54 54
55 if (Constrain(bitmap.width(), &bitmap_start_x, &width) && 55 if (Constrain(bitmap.width(), &bitmap_start_x, &width) &&
56 Constrain(bitmap.height(), &bitmap_start_y, &height)) { 56 Constrain(bitmap.height(), &bitmap_start_y, &height)) {
57 SkAutoLockPixels lock(bitmap); 57 SkAutoLockPixels lock(bitmap);
58 SkASSERT(bitmap.rowBytes() % sizeof(uint32_t) == 0u); 58 SkASSERT(bitmap.rowBytes() % sizeof(uint32_t) == 0u);
59 size_t row_words = bitmap.rowBytes() / sizeof(uint32_t); 59 size_t row_words = bitmap.rowBytes() / sizeof(uint32_t);
60 // Set data to the first pixel to be modified. 60 // Set data to the first pixel to be modified.
61 uint32_t* data = bitmap.getAddr32(0, 0) + (bitmap_start_y * row_words) + 61 uint32_t* data = bitmap.getAddr32(0, 0) + (bitmap_start_y * row_words) +
62 bitmap_start_x; 62 bitmap_start_x;
63 for (int i = 0; i < height; i++) { 63 for (int i = 0; i < height; i++) {
64 for (int j = 0; j < width; j++) 64 for (int j = 0; j < width; j++)
65 data[j] |= (0xFF << SK_A32_SHIFT); 65 data[j] |= (0xFF << SK_A32_SHIFT);
66 data += row_words; 66 data += row_words;
67 } 67 }
68 } 68 }
69 } 69 }
70 70
71 } 71 }
OLDNEW
« no previous file with comments | « printing/printing_context_win.cc ('k') | skia/ext/bitmap_platform_device_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698