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

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

Issue 1467403002: Move Windows DC-initialization to skia_utils_win.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move-metafile-from-device
Patch Set: Rebase again Created 5 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/platform_device.h ('k') | skia/ext/skia_utils_win.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 "skia/ext/platform_device.h" 5 #include "skia/ext/platform_device.h"
6 6
7 #include "skia/ext/skia_utils_win.h" 7 #include "skia/ext/skia_utils_win.h"
8 #include "third_party/skia/include/core/SkMatrix.h" 8 #include "third_party/skia/include/core/SkMatrix.h"
9 #include "third_party/skia/include/core/SkPath.h" 9 #include "third_party/skia/include/core/SkPath.h"
10 #include "third_party/skia/include/core/SkRegion.h" 10 #include "third_party/skia/include/core/SkRegion.h"
11 11
12 namespace skia { 12 namespace skia {
13 13
14 void InitializeDC(HDC context) {
15 // Enables world transformation.
16 // If the GM_ADVANCED graphics mode is set, GDI always draws arcs in the
17 // counterclockwise direction in logical space. This is equivalent to the
18 // statement that, in the GM_ADVANCED graphics mode, both arc control points
19 // and arcs themselves fully respect the device context's world-to-device
20 // transformation.
21 BOOL res = SetGraphicsMode(context, GM_ADVANCED);
22 SkASSERT(res != 0);
23
24 // Enables dithering.
25 res = SetStretchBltMode(context, HALFTONE);
26 SkASSERT(res != 0);
27 // As per SetStretchBltMode() documentation, SetBrushOrgEx() must be called
28 // right after.
29 res = SetBrushOrgEx(context, 0, 0, NULL);
30 SkASSERT(res != 0);
31
32 // Sets up default orientation.
33 res = SetArcDirection(context, AD_CLOCKWISE);
34 SkASSERT(res != 0);
35
36 // Sets up default colors.
37 res = SetBkColor(context, RGB(255, 255, 255));
38 SkASSERT(res != CLR_INVALID);
39 res = SetTextColor(context, RGB(0, 0, 0));
40 SkASSERT(res != CLR_INVALID);
41 res = SetDCBrushColor(context, RGB(255, 255, 255));
42 SkASSERT(res != CLR_INVALID);
43 res = SetDCPenColor(context, RGB(0, 0, 0));
44 SkASSERT(res != CLR_INVALID);
45
46 // Sets up default transparency.
47 res = SetBkMode(context, OPAQUE);
48 SkASSERT(res != 0);
49 res = SetROP2(context, R2_COPYPEN);
50 SkASSERT(res != 0);
51 }
52
53 PlatformSurface PlatformDevice::BeginPlatformPaint() { 14 PlatformSurface PlatformDevice::BeginPlatformPaint() {
54 return 0; 15 return 0;
55 } 16 }
56 17
57 void PlatformDevice::EndPlatformPaint() { 18 void PlatformDevice::EndPlatformPaint() {
58 // We don't clear the DC here since it will be likely to be used again. 19 // We don't clear the DC here since it will be likely to be used again.
59 // Flushing will be done in onAccessBitmap. 20 // Flushing will be done in onAccessBitmap.
60 } 21 }
61 22
62 // static 23 // static
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 LoadPathToDC(context, path); 184 LoadPathToDC(context, path);
224 hrgn = PathToRegion(context); 185 hrgn = PathToRegion(context);
225 } 186 }
226 int result = SelectClipRgn(context, hrgn); 187 int result = SelectClipRgn(context, hrgn);
227 SkASSERT(result != ERROR); 188 SkASSERT(result != ERROR);
228 result = DeleteObject(hrgn); 189 result = DeleteObject(hrgn);
229 SkASSERT(result != 0); 190 SkASSERT(result != 0);
230 } 191 }
231 192
232 } // namespace skia 193 } // namespace skia
OLDNEW
« no previous file with comments | « skia/ext/platform_device.h ('k') | skia/ext/skia_utils_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698