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

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

Issue 2610323004: Remove skia::DrawToNativeContext() (Closed)
Patch Set: missing header Created 3 years, 11 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
« no previous file with comments | « content/browser/compositor/software_output_device_win.cc ('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 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/debug/gdi_debug_util_win.h" 9 #include "base/debug/gdi_debug_util_win.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 15 matching lines...) Expand all
26 int result = SelectClipRgn(context, hrgn); 26 int result = SelectClipRgn(context, hrgn);
27 SkASSERT(result != ERROR); 27 SkASSERT(result != ERROR);
28 result = DeleteObject(hrgn); 28 result = DeleteObject(hrgn);
29 SkASSERT(result != 0); 29 SkASSERT(result != 0);
30 } 30 }
31 31
32 } // namespace 32 } // namespace
33 33
34 namespace skia { 34 namespace skia {
35 35
36 void DrawToNativeContext(SkCanvas* canvas, HDC destination_hdc, int x, int y,
37 const RECT* src_rect) {
38 RECT temp_rect;
39 if (!src_rect) {
40 temp_rect.left = 0;
41 temp_rect.right = canvas->imageInfo().width();
42 temp_rect.top = 0;
43 temp_rect.bottom = canvas->imageInfo().height();
44 src_rect = &temp_rect;
45 }
46 skia::CopyHDC(skia::GetNativeDrawingContext(canvas), destination_hdc, x, y,
47 canvas->imageInfo().isOpaque(), *src_rect,
48 canvas->getTotalMatrix());
49 }
50
51 HDC GetNativeDrawingContext(SkCanvas* canvas) { 36 HDC GetNativeDrawingContext(SkCanvas* canvas) {
52 PlatformDevice* platform_device = GetPlatformDevice(canvas->getTopDevice(true) ); 37 PlatformDevice* platform_device = GetPlatformDevice(canvas->getTopDevice(true) );
53 if (!platform_device) 38 if (!platform_device)
54 return nullptr; 39 return nullptr;
55 40
56 // Compensate for drawing to a layer rather than the entire canvas 41 // Compensate for drawing to a layer rather than the entire canvas
57 SkMatrix ctm; 42 SkMatrix ctm;
58 SkIRect clip_bounds; 43 SkIRect clip_bounds;
59 canvas->temporary_internal_describeTopLayer(&ctm, &clip_bounds); 44 canvas->temporary_internal_describeTopLayer(&ctm, &clip_bounds);
60 45
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 int height, 209 int height,
225 bool is_opaque, 210 bool is_opaque,
226 HANDLE shared_section, 211 HANDLE shared_section,
227 OnFailureType failureType) { 212 OnFailureType failureType) {
228 sk_sp<SkBaseDevice> dev( 213 sk_sp<SkBaseDevice> dev(
229 BitmapPlatformDevice::Create(width, height, is_opaque, shared_section)); 214 BitmapPlatformDevice::Create(width, height, is_opaque, shared_section));
230 return CreateCanvas(dev, failureType); 215 return CreateCanvas(dev, failureType);
231 } 216 }
232 217
233 } // namespace skia 218 } // namespace skia
OLDNEW
« no previous file with comments | « content/browser/compositor/software_output_device_win.cc ('k') | skia/ext/platform_canvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698