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

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

Issue 1986383002: SkCanvas::adjustToTopLayer() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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
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 2018 matching lines...) Expand 10 before | Expand all | Expand 10 after
2029 void SkCanvas::legacy_drawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst, 2029 void SkCanvas::legacy_drawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst,
2030 const SkPaint* paint, SrcRectConstraint con straint) { 2030 const SkPaint* paint, SrcRectConstraint con straint) {
2031 if (src) { 2031 if (src) {
2032 this->drawBitmapRect(bitmap, *src, dst, paint, constraint); 2032 this->drawBitmapRect(bitmap, *src, dst, paint, constraint);
2033 } else { 2033 } else {
2034 this->drawBitmapRect(bitmap, SkRect::MakeIWH(bitmap.width(), bitmap.heig ht()), 2034 this->drawBitmapRect(bitmap, SkRect::MakeIWH(bitmap.width(), bitmap.heig ht()),
2035 dst, paint, constraint); 2035 dst, paint, constraint);
2036 } 2036 }
2037 } 2037 }
2038 2038
2039 void SkCanvas::adjustToTopLayer(SkMatrix* matrix, SkIRect* clip_bounds) {
2040 SkIRect layer_bounds = this->getTopLayerBounds();
2041 if (clip_bounds) {
2042 clip_bounds->offset(-layer_bounds.left(), -layer_bounds.top());
2043 }
2044 if (matrix) {
2045 matrix->preTranslate(-layer_bounds.left(), -layer_bounds.top());
2046 }
2047 }
2048
2039 ////////////////////////////////////////////////////////////////////////////// 2049 //////////////////////////////////////////////////////////////////////////////
2040 // These are the virtual drawing methods 2050 // These are the virtual drawing methods
2041 ////////////////////////////////////////////////////////////////////////////// 2051 //////////////////////////////////////////////////////////////////////////////
2042 2052
2043 void SkCanvas::onDiscard() { 2053 void SkCanvas::onDiscard() {
2044 if (fSurfaceBase) { 2054 if (fSurfaceBase) {
2045 fSurfaceBase->aboutToDraw(SkSurface::kDiscard_ContentChangeMode); 2055 fSurfaceBase->aboutToDraw(SkSurface::kDiscard_ContentChangeMode);
2046 } 2056 }
2047 } 2057 }
2048 2058
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after
3062 3072
3063 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 3073 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
3064 fCanvas->restoreToCount(fSaveCount); 3074 fCanvas->restoreToCount(fSaveCount);
3065 } 3075 }
3066 3076
3067 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API 3077 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API
3068 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p rops) { 3078 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p rops) {
3069 return this->makeSurface(info, props).release(); 3079 return this->makeSurface(info, props).release();
3070 } 3080 }
3071 #endif 3081 #endif
OLDNEW
« include/core/SkCanvas.h ('K') | « include/core/SkCanvas.h ('k') | tests/CanvasTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698