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

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

Issue 2167223002: Revert of Creating framework for drawShadowedPicture (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 4 years, 5 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/private/SkRecords.h ('k') | src/core/SkLightingShader.cpp » ('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 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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 // const-cast. 658 // const-cast.
659 *const_cast<bool*>(&fConservativeRasterClip) = SkToBool(flags & kConservativ eRasterClip_InitFlag); 659 *const_cast<bool*>(&fConservativeRasterClip) = SkToBool(flags & kConservativ eRasterClip_InitFlag);
660 660
661 fCachedLocalClipBounds.setEmpty(); 661 fCachedLocalClipBounds.setEmpty();
662 fCachedLocalClipBoundsDirty = true; 662 fCachedLocalClipBoundsDirty = true;
663 fAllowSoftClip = true; 663 fAllowSoftClip = true;
664 fAllowSimplifyClip = false; 664 fAllowSimplifyClip = false;
665 fDeviceCMDirty = true; 665 fDeviceCMDirty = true;
666 fSaveCount = 1; 666 fSaveCount = 1;
667 fMetaData = nullptr; 667 fMetaData = nullptr;
668 #ifdef SK_EXPERIMENTAL_SHADOWING
669 fLights = nullptr;
670 #endif
671 668
672 fClipStack.reset(new SkClipStack); 669 fClipStack.reset(new SkClipStack);
673 670
674 fMCRec = (MCRec*)fMCStack.push_back(); 671 fMCRec = (MCRec*)fMCStack.push_back();
675 new (fMCRec) MCRec(fConservativeRasterClip); 672 new (fMCRec) MCRec(fConservativeRasterClip);
676 673
677 SkASSERT(sizeof(DeviceCM) <= sizeof(fDeviceCMStorage)); 674 SkASSERT(sizeof(DeviceCM) <= sizeof(fDeviceCMStorage));
678 fMCRec->fLayer = (DeviceCM*)fDeviceCMStorage; 675 fMCRec->fLayer = (DeviceCM*)fDeviceCMStorage;
679 new (fDeviceCMStorage) DeviceCM(nullptr, nullptr, nullptr, fConservativeRast erClip, false, 676 new (fDeviceCMStorage) DeviceCM(nullptr, nullptr, nullptr, fConservativeRast erClip, false,
680 fMCRec->fMatrix); 677 fMCRec->fMatrix);
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after
1540 void SkCanvas::setMatrix(const SkMatrix& matrix) { 1537 void SkCanvas::setMatrix(const SkMatrix& matrix) {
1541 this->checkForDeferredSave(); 1538 this->checkForDeferredSave();
1542 this->internalSetMatrix(matrix); 1539 this->internalSetMatrix(matrix);
1543 this->didSetMatrix(matrix); 1540 this->didSetMatrix(matrix);
1544 } 1541 }
1545 1542
1546 void SkCanvas::resetMatrix() { 1543 void SkCanvas::resetMatrix() {
1547 this->setMatrix(SkMatrix::I()); 1544 this->setMatrix(SkMatrix::I());
1548 } 1545 }
1549 1546
1550 #ifdef SK_EXPERIMENTAL_SHADOWING
1551 void SkCanvas::translateZ(SkScalar z) { 1547 void SkCanvas::translateZ(SkScalar z) {
1552 this->checkForDeferredSave(); 1548 this->checkForDeferredSave();
1553 this->fMCRec->fCurDrawDepth += z; 1549 this->fMCRec->fCurDrawDepth += z;
1554 this->didTranslateZ(z); 1550 this->didTranslateZ(z);
1555 } 1551 }
1556 1552
1557 SkScalar SkCanvas::getZ() const { 1553 SkScalar SkCanvas::getZ() const {
1558 return this->fMCRec->fCurDrawDepth; 1554 return this->fMCRec->fCurDrawDepth;
1559 } 1555 }
1560 1556
1561 void SkCanvas::setLights(sk_sp<SkLights> lights) {
1562 this->fLights = lights;
1563 }
1564
1565 sk_sp<SkLights> SkCanvas::getLights() const {
1566 return this->fLights;
1567 }
1568 #endif
1569
1570 ////////////////////////////////////////////////////////////////////////////// 1557 //////////////////////////////////////////////////////////////////////////////
1571 1558
1572 void SkCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) { 1559 void SkCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) {
1573 if (!fAllowSoftClip) { 1560 if (!fAllowSoftClip) {
1574 doAA = false; 1561 doAA = false;
1575 } 1562 }
1576 1563
1577 #ifdef SK_SUPPORT_PRECHECK_CLIPRECT 1564 #ifdef SK_SUPPORT_PRECHECK_CLIPRECT
1578 // Check if we can quick-accept the clip call (and do nothing) 1565 // Check if we can quick-accept the clip call (and do nothing)
1579 // 1566 //
(...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after
3037 } 3024 }
3038 if (this->quickReject(bounds)) { 3025 if (this->quickReject(bounds)) {
3039 return; 3026 return;
3040 } 3027 }
3041 } 3028 }
3042 3029
3043 SkAutoCanvasMatrixPaint acmp(this, matrix, paint, picture->cullRect()); 3030 SkAutoCanvasMatrixPaint acmp(this, matrix, paint, picture->cullRect());
3044 picture->playback(this); 3031 picture->playback(this);
3045 } 3032 }
3046 3033
3047 #ifdef SK_EXPERIMENTAL_SHADOWING
3048 void SkCanvas::drawShadowedPicture(const SkPicture* picture,
3049 const SkMatrix* matrix,
3050 const SkPaint* paint) {
3051 RETURN_ON_NULL(picture);
3052
3053 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawShadowedPicture()");
3054
3055 this->onDrawShadowedPicture(picture, matrix, paint);
3056 }
3057
3058 void SkCanvas::onDrawShadowedPicture(const SkPicture* picture,
3059 const SkMatrix* matrix,
3060 const SkPaint* paint) {
3061 this->onDrawPicture(picture, matrix, paint);
3062 }
3063 #endif
3064
3065 /////////////////////////////////////////////////////////////////////////////// 3034 ///////////////////////////////////////////////////////////////////////////////
3066 /////////////////////////////////////////////////////////////////////////////// 3035 ///////////////////////////////////////////////////////////////////////////////
3067 3036
3068 SkCanvas::LayerIter::LayerIter(SkCanvas* canvas, bool skipEmptyClips) { 3037 SkCanvas::LayerIter::LayerIter(SkCanvas* canvas, bool skipEmptyClips) {
3069 static_assert(sizeof(fStorage) >= sizeof(SkDrawIter), "fStorage_too_small"); 3038 static_assert(sizeof(fStorage) >= sizeof(SkDrawIter), "fStorage_too_small");
3070 3039
3071 SkASSERT(canvas); 3040 SkASSERT(canvas);
3072 3041
3073 fImpl = new (fStorage) SkDrawIter(canvas, skipEmptyClips); 3042 fImpl = new (fStorage) SkDrawIter(canvas, skipEmptyClips);
3074 fDone = !fImpl->next(); 3043 fDone = !fImpl->next();
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
3165 3134
3166 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 3135 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
3167 fCanvas->restoreToCount(fSaveCount); 3136 fCanvas->restoreToCount(fSaveCount);
3168 } 3137 }
3169 3138
3170 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API 3139 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API
3171 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p rops) { 3140 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p rops) {
3172 return this->makeSurface(info, props).release(); 3141 return this->makeSurface(info, props).release();
3173 } 3142 }
3174 #endif 3143 #endif
OLDNEW
« no previous file with comments | « include/private/SkRecords.h ('k') | src/core/SkLightingShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698