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

Side by Side Diff: skia/ext/bitmap_platform_device_win.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 | « skia/ext/bitmap_platform_device_win.h ('k') | skia/ext/canvas_paint_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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <windows.h> 5 #include <windows.h>
6 #include <psapi.h> 6 #include <psapi.h>
7 7
8 #include "skia/ext/bitmap_platform_device_win.h" 8 #include "skia/ext/bitmap_platform_device_win.h"
9 9
10 #include "skia/ext/bitmap_platform_device_data.h" 10 #include "skia/ext/bitmap_platform_device_data.h"
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 SkASSERT(begin_paint_count_--); 213 SkASSERT(begin_paint_count_--);
214 PlatformDevice::EndPlatformPaint(); 214 PlatformDevice::EndPlatformPaint();
215 } 215 }
216 216
217 void BitmapPlatformDevice::setMatrixClip(const SkMatrix& transform, 217 void BitmapPlatformDevice::setMatrixClip(const SkMatrix& transform,
218 const SkRegion& region, 218 const SkRegion& region,
219 const SkClipStack&) { 219 const SkClipStack&) {
220 data_->SetMatrixClip(transform, region); 220 data_->SetMatrixClip(transform, region);
221 } 221 }
222 222
223 void BitmapPlatformDevice::drawToHDC(HDC dc, int x, int y, 223 void BitmapPlatformDevice::DrawToNativeContext(HDC dc, int x, int y,
224 const RECT* src_rect) { 224 const RECT* src_rect) {
225 bool created_dc = !data_->IsBitmapDCCreated(); 225 bool created_dc = !data_->IsBitmapDCCreated();
226 HDC source_dc = BeginPlatformPaint(); 226 HDC source_dc = BeginPlatformPaint();
227 227
228 RECT temp_rect; 228 RECT temp_rect;
229 if (!src_rect) { 229 if (!src_rect) {
230 temp_rect.left = 0; 230 temp_rect.left = 0;
231 temp_rect.right = width(); 231 temp_rect.right = width();
232 temp_rect.top = 0; 232 temp_rect.top = 0;
233 temp_rect.bottom = height(); 233 temp_rect.bottom = height();
234 src_rect = &temp_rect; 234 src_rect = &temp_rect;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 copy_height, 268 copy_height,
269 blend_function); 269 blend_function);
270 } 270 }
271 LoadTransformToDC(source_dc, data_->transform()); 271 LoadTransformToDC(source_dc, data_->transform());
272 272
273 EndPlatformPaint(); 273 EndPlatformPaint();
274 if (created_dc) 274 if (created_dc)
275 data_->ReleaseBitmapDC(); 275 data_->ReleaseBitmapDC();
276 } 276 }
277 277
278 // Returns the color value at the specified location.
279 SkColor BitmapPlatformDevice::getColorAt(int x, int y) {
280 const SkBitmap& bitmap = accessBitmap(false);
281 SkAutoLockPixels lock(bitmap);
282 uint32_t* data = bitmap.getAddr32(0, 0);
283 return static_cast<SkColor>(data[x + y * width()]);
284 }
285
286 void BitmapPlatformDevice::onAccessBitmap(SkBitmap* bitmap) { 278 void BitmapPlatformDevice::onAccessBitmap(SkBitmap* bitmap) {
287 // FIXME(brettw) OPTIMIZATION: We should only flush if we know a GDI 279 // FIXME(brettw) OPTIMIZATION: We should only flush if we know a GDI
288 // operation has occurred on our DC. 280 // operation has occurred on our DC.
289 if (data_->IsBitmapDCCreated()) 281 if (data_->IsBitmapDCCreated())
290 GdiFlush(); 282 GdiFlush();
291 } 283 }
292 284
293 SkDeviceFactory* BitmapPlatformDevice::onNewDeviceFactory() { 285 SkDeviceFactory* BitmapPlatformDevice::onNewDeviceFactory() {
294 return SkNEW(BitmapPlatformDeviceFactory); 286 return SkNEW(BitmapPlatformDeviceFactory);
295 } 287 }
296 288
297 } // namespace skia 289 } // namespace skia
298 290
OLDNEW
« no previous file with comments | « skia/ext/bitmap_platform_device_win.h ('k') | skia/ext/canvas_paint_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698