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

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

Issue 1129843003: Make drawImage a virtual on SkDevice (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/core/SkPaintPriv.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 /* 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 "SkDrawFilter.h" 11 #include "SkDrawFilter.h"
12 #include "SkImage_Base.h"
12 #include "SkMetaData.h" 13 #include "SkMetaData.h"
13 #include "SkPatchUtils.h" 14 #include "SkPatchUtils.h"
14 #include "SkPathMeasure.h" 15 #include "SkPathMeasure.h"
15 #include "SkRasterClip.h" 16 #include "SkRasterClip.h"
16 #include "SkShader.h" 17 #include "SkShader.h"
17 #include "SkTextBlob.h" 18 #include "SkTextBlob.h"
18 #include "SkTextToPathIter.h" 19 #include "SkTextToPathIter.h"
19 20
20 SkBaseDevice::SkBaseDevice() 21 SkBaseDevice::SkBaseDevice()
21 : fLeakyProperties(SkNEW_ARGS(SkDeviceProperties, (SkDeviceProperties::kLega cyLCD_InitType))) 22 : fLeakyProperties(SkNEW_ARGS(SkDeviceProperties, (SkDeviceProperties::kLega cyLCD_InitType)))
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 SkFAIL("unhandled positioning mode"); 159 SkFAIL("unhandled positioning mode");
159 } 160 }
160 161
161 if (drawFilter) { 162 if (drawFilter) {
162 // A draw filter may change the paint arbitrarily, so we must re-see d in this case. 163 // A draw filter may change the paint arbitrarily, so we must re-see d in this case.
163 runPaint = paint; 164 runPaint = paint;
164 } 165 }
165 } 166 }
166 } 167 }
167 168
169 void SkBaseDevice::drawImage(const SkDraw& draw, const SkImage* image, SkScalar x, SkScalar y,
170 const SkPaint& paint) {
171 // Default impl : turns everything into raster bitmap
172 SkBitmap bm;
173 if (as_IB(image)->getROPixels(&bm)) {
174 this->drawBitmap(draw, bm, SkMatrix::MakeTrans(x, y), paint);
175 }
176 }
177
178 void SkBaseDevice::drawImageRect(const SkDraw& draw, const SkImage* image, const SkRect* src,
179 const SkRect& dst, const SkPaint& paint) {
180 // Default impl : turns everything into raster bitmap
181 SkBitmap bm;
182 if (as_IB(image)->getROPixels(&bm)) {
183 this->drawBitmapRect(draw, bm, src, dst, paint, SkCanvas::kNone_DrawBitm apRectFlag);
184 }
185 }
186
168 bool SkBaseDevice::readPixels(const SkImageInfo& info, void* dstP, size_t rowByt es, int x, int y) { 187 bool SkBaseDevice::readPixels(const SkImageInfo& info, void* dstP, size_t rowByt es, int x, int y) {
169 #ifdef SK_DEBUG 188 #ifdef SK_DEBUG
170 SkASSERT(info.width() > 0 && info.height() > 0); 189 SkASSERT(info.width() > 0 && info.height() > 0);
171 SkASSERT(dstP); 190 SkASSERT(dstP);
172 SkASSERT(rowBytes >= info.minRowBytes()); 191 SkASSERT(rowBytes >= info.minRowBytes());
173 SkASSERT(x >= 0 && y >= 0); 192 SkASSERT(x >= 0 && y >= 0);
174 193
175 const SkImageInfo& srcInfo = this->imageInfo(); 194 const SkImageInfo& srcInfo = this->imageInfo();
176 SkASSERT(x + info.width() <= srcInfo.width()); 195 SkASSERT(x + info.width() <= srcInfo.width());
177 SkASSERT(y + info.height() <= srcInfo.height()); 196 SkASSERT(y + info.height() <= srcInfo.height());
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 if (kUnknown_SkPixelGeometry == fLeakyProperties->pixelGeometry() 378 if (kUnknown_SkPixelGeometry == fLeakyProperties->pixelGeometry()
360 || this->onShouldDisableLCD(paint)) { 379 || this->onShouldDisableLCD(paint)) {
361 380
362 flags &= ~SkPaint::kLCDRenderText_Flag; 381 flags &= ~SkPaint::kLCDRenderText_Flag;
363 flags |= SkPaint::kGenA8FromLCD_Flag; 382 flags |= SkPaint::kGenA8FromLCD_Flag;
364 } 383 }
365 384
366 return flags; 385 return flags;
367 } 386 }
368 387
OLDNEW
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/core/SkPaintPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698