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

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

Issue 787803004: Update from https://crrev.com/307664 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase. Created 6 years 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
« no previous file with comments | « skia/ext/bitmap_platform_device_win.h ('k') | skia/ext/platform_canvas.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/debug/gdi_debug_util_win.h" 8 #include "base/debug/gdi_debug_util_win.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "skia/ext/bitmap_platform_device_win.h" 10 #include "skia/ext/bitmap_platform_device_win.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 base::debug::GDIBitmapAllocFailure(&hdr, shared_section); 48 base::debug::GDIBitmapAllocFailure(&hdr, shared_section);
49 #endif 49 #endif
50 50
51 return hbitmap; 51 return hbitmap;
52 } 52 }
53 53
54 } // namespace 54 } // namespace
55 55
56 namespace skia { 56 namespace skia {
57 57
58 void DrawToNativeContext(SkCanvas* canvas, HDC hdc, int x, int y,
59 const RECT* src_rect) {
60 PlatformDevice* platform_device = GetPlatformDevice(GetTopDevice(*canvas));
61 if (platform_device)
62 platform_device->DrawToHDC(hdc, x, y, src_rect);
63 }
64
65 void PlatformDevice::DrawToHDC(HDC, int x, int y, const RECT* src_rect) {}
66
58 HDC BitmapPlatformDevice::GetBitmapDC() { 67 HDC BitmapPlatformDevice::GetBitmapDC() {
59 if (!hdc_) { 68 if (!hdc_) {
60 hdc_ = CreateCompatibleDC(NULL); 69 hdc_ = CreateCompatibleDC(NULL);
61 InitializeDC(hdc_); 70 InitializeDC(hdc_);
62 old_hbitmap_ = static_cast<HBITMAP>(SelectObject(hdc_, hbitmap_)); 71 old_hbitmap_ = static_cast<HBITMAP>(SelectObject(hdc_, hbitmap_));
63 } 72 }
64 73
65 LoadConfig(); 74 LoadConfig();
66 return hdc_; 75 return hdc_;
67 } 76 }
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 SkASSERT(begin_paint_count_--); 204 SkASSERT(begin_paint_count_--);
196 PlatformDevice::EndPlatformPaint(); 205 PlatformDevice::EndPlatformPaint();
197 } 206 }
198 207
199 void BitmapPlatformDevice::setMatrixClip(const SkMatrix& transform, 208 void BitmapPlatformDevice::setMatrixClip(const SkMatrix& transform,
200 const SkRegion& region, 209 const SkRegion& region,
201 const SkClipStack&) { 210 const SkClipStack&) {
202 SetMatrixClip(transform, region); 211 SetMatrixClip(transform, region);
203 } 212 }
204 213
205 void BitmapPlatformDevice::DrawToNativeContext(HDC dc, int x, int y, 214 void BitmapPlatformDevice::DrawToHDC(HDC dc, int x, int y,
206 const RECT* src_rect) { 215 const RECT* src_rect) {
207 bool created_dc = !IsBitmapDCCreated(); 216 bool created_dc = !IsBitmapDCCreated();
208 HDC source_dc = BeginPlatformPaint(); 217 HDC source_dc = BeginPlatformPaint();
209 218
210 RECT temp_rect; 219 RECT temp_rect;
211 if (!src_rect) { 220 if (!src_rect) {
212 temp_rect.left = 0; 221 temp_rect.left = 0;
213 temp_rect.right = width(); 222 temp_rect.right = width();
214 temp_rect.top = 0; 223 temp_rect.top = 0;
215 temp_rect.bottom = height(); 224 temp_rect.bottom = height();
216 src_rect = &temp_rect; 225 src_rect = &temp_rect;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 platform_extra_ = reinterpret_cast<intptr_t>(stock_bitmap); 319 platform_extra_ = reinterpret_cast<intptr_t>(stock_bitmap);
311 320
312 if (!InstallHBitmapPixels(&bitmap_, width, height, is_opaque, data, hbitmap)) 321 if (!InstallHBitmapPixels(&bitmap_, width, height, is_opaque, data, hbitmap))
313 return false; 322 return false;
314 bitmap_.lockPixels(); 323 bitmap_.lockPixels();
315 324
316 return true; 325 return true;
317 } 326 }
318 327
319 } // namespace skia 328 } // namespace skia
OLDNEW
« no previous file with comments | « skia/ext/bitmap_platform_device_win.h ('k') | skia/ext/platform_canvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698