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

Side by Side Diff: src/core/SkDevice.cpp

Issue 774063002: Revert of implement device::clear until we can remove callers in chrome skia/ext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkDevice.h" 8 #include "SkDevice.h"
9 #include "SkDeviceProperties.h" 9 #include "SkDeviceProperties.h"
10 #include "SkDraw.h" 10 #include "SkDraw.h"
11 #include "SkMetaData.h" 11 #include "SkMetaData.h"
12 #include "SkPatchUtils.h" 12 #include "SkPatchUtils.h"
13 #include "SkRasterClip.h"
14 #include "SkShader.h" 13 #include "SkShader.h"
15 #include "SkTextBlob.h" 14 #include "SkTextBlob.h"
16 15
17 SkBaseDevice::SkBaseDevice() 16 SkBaseDevice::SkBaseDevice()
18 : fLeakyProperties(SkNEW_ARGS(SkDeviceProperties, (SkDeviceProperties::kLega cyLCD_InitType))) 17 : fLeakyProperties(SkNEW_ARGS(SkDeviceProperties, (SkDeviceProperties::kLega cyLCD_InitType)))
19 #ifdef SK_DEBUG 18 #ifdef SK_DEBUG
20 , fAttachedToCanvas(false) 19 , fAttachedToCanvas(false)
21 #endif 20 #endif
22 { 21 {
23 fOrigin.setZero(); 22 fOrigin.setZero();
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 kGeneral_Usage , 85 kGeneral_Usage ,
87 geo)); 86 geo));
88 } 87 }
89 88
90 SkSurface* SkBaseDevice::newSurface(const SkImageInfo&, const SkSurfaceProps&) { return NULL; } 89 SkSurface* SkBaseDevice::newSurface(const SkImageInfo&, const SkSurfaceProps&) { return NULL; }
91 90
92 const void* SkBaseDevice::peekPixels(SkImageInfo*, size_t*) { return NULL; } 91 const void* SkBaseDevice::peekPixels(SkImageInfo*, size_t*) { return NULL; }
93 92
94 // DEPRECATED : remove when chrome subclass have been updated to not override cl ear() 93 // DEPRECATED : remove when chrome subclass have been updated to not override cl ear()
95 void SkBaseDevice::clear(SkColor color) { 94 void SkBaseDevice::clear(SkColor color) {
96 SkPaint paint; 95 SkFAIL("SkDevice::clear() should not be called");
97 paint.setColor(color);
98 paint.setXfermodeMode(SkXfermode::kSrc_Mode);
99
100 SkMatrix matrix;
101 matrix.reset();
102
103 SkRasterClip rc(SkIRect::MakeWH(this->width(), this->height()));
104
105 SkDraw draw;
106 sk_bzero(&draw, sizeof(draw));
107
108 draw.fBitmap = &this->accessBitmap(true);
109 draw.fMatrix = &matrix;
110 draw.fClip = &rc.forceGetBW();
111 draw.fRC = &rc;
112 draw.fDevice = this;
113 this->drawPaint(draw, paint);
114 } 96 }
115 97
116 void SkBaseDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer, 98 void SkBaseDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer,
117 const SkRRect& inner, const SkPaint& paint) { 99 const SkRRect& inner, const SkPaint& paint) {
118 SkPath path; 100 SkPath path;
119 path.addRRect(outer); 101 path.addRRect(outer);
120 path.addRRect(inner); 102 path.addRRect(inner);
121 path.setFillType(SkPath::kEvenOdd_FillType); 103 path.setFillType(SkPath::kEvenOdd_FillType);
122 104
123 const SkMatrix* preMatrix = NULL; 105 const SkMatrix* preMatrix = NULL;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 if (kUnknown_SkPixelGeometry == fLeakyProperties->pixelGeometry() 227 if (kUnknown_SkPixelGeometry == fLeakyProperties->pixelGeometry()
246 || this->onShouldDisableLCD(paint)) { 228 || this->onShouldDisableLCD(paint)) {
247 229
248 flags &= ~SkPaint::kLCDRenderText_Flag; 230 flags &= ~SkPaint::kLCDRenderText_Flag;
249 flags |= SkPaint::kGenA8FromLCD_Flag; 231 flags |= SkPaint::kGenA8FromLCD_Flag;
250 } 232 }
251 233
252 return flags; 234 return flags;
253 } 235 }
254 236
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698