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

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

Issue 2308733002: remove unused SkDevice::setMatrixClip (Closed)
Patch Set: Created 4 years, 3 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 | « include/core/SkDevice.h ('k') | 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 2008 The Android Open Source Project 2 * Copyright 2008 The Android Open Source Project
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 "SkBitmapDevice.h" 8 #include "SkBitmapDevice.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkCanvasPriv.h" 10 #include "SkCanvasPriv.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 } 208 }
209 209
210 void reset(const SkIRect& bounds) { 210 void reset(const SkIRect& bounds) {
211 SkASSERT(!fPaint); 211 SkASSERT(!fPaint);
212 SkASSERT(!fNext); 212 SkASSERT(!fNext);
213 SkASSERT(fDevice); 213 SkASSERT(fDevice);
214 fClip.setRect(bounds); 214 fClip.setRect(bounds);
215 } 215 }
216 216
217 void updateMC(const SkMatrix& totalMatrix, const SkRasterClip& totalClip, 217 void updateMC(const SkMatrix& totalMatrix, const SkRasterClip& totalClip,
218 const SkClipStack& clipStack, SkRasterClip* updateClip) { 218 SkRasterClip* updateClip) {
219 int x = fDevice->getOrigin().x(); 219 int x = fDevice->getOrigin().x();
220 int y = fDevice->getOrigin().y(); 220 int y = fDevice->getOrigin().y();
221 int width = fDevice->width(); 221 int width = fDevice->width();
222 int height = fDevice->height(); 222 int height = fDevice->height();
223 223
224 if ((x | y) == 0) { 224 if ((x | y) == 0) {
225 fMatrix = &totalMatrix; 225 fMatrix = &totalMatrix;
226 fClip = totalClip; 226 fClip = totalClip;
227 } else { 227 } else {
228 fMatrixStorage = totalMatrix; 228 fMatrixStorage = totalMatrix;
229 fMatrixStorage.postTranslate(SkIntToScalar(-x), 229 fMatrixStorage.postTranslate(SkIntToScalar(-x),
230 SkIntToScalar(-y)); 230 SkIntToScalar(-y));
231 fMatrix = &fMatrixStorage; 231 fMatrix = &fMatrixStorage;
232 232
233 totalClip.translate(-x, -y, &fClip); 233 totalClip.translate(-x, -y, &fClip);
234 } 234 }
235 235
236 fClip.op(SkIRect::MakeWH(width, height), SkRegion::kIntersect_Op); 236 fClip.op(SkIRect::MakeWH(width, height), SkRegion::kIntersect_Op);
237 237
238 // intersect clip, but don't translate it (yet) 238 // intersect clip, but don't translate it (yet)
239 239
240 if (updateClip) { 240 if (updateClip) {
241 updateClip->op(SkIRect::MakeXYWH(x, y, width, height), 241 updateClip->op(SkIRect::MakeXYWH(x, y, width, height),
242 SkRegion::kDifference_Op); 242 SkRegion::kDifference_Op);
243 } 243 }
244 244
245 fDevice->setMatrixClip(*fMatrix, fClip.forceGetBW(), clipStack);
246
247 #ifdef SK_DEBUG 245 #ifdef SK_DEBUG
248 if (!fClip.isEmpty()) { 246 if (!fClip.isEmpty()) {
249 SkIRect deviceR; 247 SkIRect deviceR;
250 deviceR.set(0, 0, width, height); 248 deviceR.set(0, 0, width, height);
251 SkASSERT(deviceR.contains(fClip.getBounds())); 249 SkASSERT(deviceR.contains(fClip.getBounds()));
252 } 250 }
253 #endif 251 #endif
254 } 252 }
255 }; 253 };
256 254
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 953
956 ////////////////////////////////////////////////////////////////////////////// 954 //////////////////////////////////////////////////////////////////////////////
957 955
958 void SkCanvas::updateDeviceCMCache() { 956 void SkCanvas::updateDeviceCMCache() {
959 if (fDeviceCMDirty) { 957 if (fDeviceCMDirty) {
960 const SkMatrix& totalMatrix = this->getTotalMatrix(); 958 const SkMatrix& totalMatrix = this->getTotalMatrix();
961 const SkRasterClip& totalClip = fMCRec->fRasterClip; 959 const SkRasterClip& totalClip = fMCRec->fRasterClip;
962 DeviceCM* layer = fMCRec->fTopLayer; 960 DeviceCM* layer = fMCRec->fTopLayer;
963 961
964 if (nullptr == layer->fNext) { // only one layer 962 if (nullptr == layer->fNext) { // only one layer
965 layer->updateMC(totalMatrix, totalClip, *fClipStack, nullptr); 963 layer->updateMC(totalMatrix, totalClip, nullptr);
966 } else { 964 } else {
967 SkRasterClip clip(totalClip); 965 SkRasterClip clip(totalClip);
968 do { 966 do {
969 layer->updateMC(totalMatrix, clip, *fClipStack, &clip); 967 layer->updateMC(totalMatrix, clip, &clip);
970 } while ((layer = layer->fNext) != nullptr); 968 } while ((layer = layer->fNext) != nullptr);
971 } 969 }
972 fDeviceCMDirty = false; 970 fDeviceCMDirty = false;
973 } 971 }
974 } 972 }
975 973
976 /////////////////////////////////////////////////////////////////////////////// 974 ///////////////////////////////////////////////////////////////////////////////
977 975
978 void SkCanvas::checkForDeferredSave() { 976 void SkCanvas::checkForDeferredSave() {
979 if (fMCRec->fDeferredSaveCount > 0) { 977 if (fMCRec->fDeferredSaveCount > 0) {
(...skipping 2466 matching lines...) Expand 10 before | Expand all | Expand 10 after
3446 3444
3447 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 3445 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
3448 fCanvas->restoreToCount(fSaveCount); 3446 fCanvas->restoreToCount(fSaveCount);
3449 } 3447 }
3450 3448
3451 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API 3449 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API
3452 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p rops) { 3450 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p rops) {
3453 return this->makeSurface(info, props).release(); 3451 return this->makeSurface(info, props).release();
3454 } 3452 }
3455 #endif 3453 #endif
OLDNEW
« no previous file with comments | « include/core/SkDevice.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698