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

Side by Side Diff: src/effects/SkPaintImageFilter.cpp

Issue 2349373004: Create special surfaces according to original device (not always in N32) (Closed)
Patch Set: Remove copy-pasted default parameter, expand comment 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 | « src/effects/SkOffsetImageFilter.cpp ('k') | src/effects/SkPictureImageFilter.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 2016 Google Inc. 2 * Copyright 2016 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 "SkPaintImageFilter.h" 8 #include "SkPaintImageFilter.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkReadBuffer.h" 10 #include "SkReadBuffer.h"
(...skipping 25 matching lines...) Expand all
36 36
37 sk_sp<SkSpecialImage> SkPaintImageFilter::onFilterImage(SkSpecialImage* source, 37 sk_sp<SkSpecialImage> SkPaintImageFilter::onFilterImage(SkSpecialImage* source,
38 const Context& ctx, 38 const Context& ctx,
39 SkIPoint* offset) const { 39 SkIPoint* offset) const {
40 SkIRect bounds; 40 SkIRect bounds;
41 const SkIRect srcBounds = SkIRect::MakeWH(source->width(), source->height()) ; 41 const SkIRect srcBounds = SkIRect::MakeWH(source->width(), source->height()) ;
42 if (!this->applyCropRect(ctx, srcBounds, &bounds)) { 42 if (!this->applyCropRect(ctx, srcBounds, &bounds)) {
43 return nullptr; 43 return nullptr;
44 } 44 }
45 45
46 SkImageInfo info = SkImageInfo::MakeN32(bounds.width(), bounds.height(), 46 sk_sp<SkSpecialSurface> surf(source->makeSurface(ctx.outputProperties(), bou nds.size()));
47 kPremul_SkAlphaType);
48
49 sk_sp<SkSpecialSurface> surf(source->makeSurface(info));
50 if (!surf) { 47 if (!surf) {
51 return nullptr; 48 return nullptr;
52 } 49 }
53 50
54 SkCanvas* canvas = surf->getCanvas(); 51 SkCanvas* canvas = surf->getCanvas();
55 SkASSERT(canvas); 52 SkASSERT(canvas);
56 53
57 canvas->clear(0x0); 54 canvas->clear(0x0);
58 55
59 SkMatrix matrix(ctx.ctm()); 56 SkMatrix matrix(ctx.ctm());
(...skipping 15 matching lines...) Expand all
75 return true; 72 return true;
76 } 73 }
77 74
78 #ifndef SK_IGNORE_TO_STRING 75 #ifndef SK_IGNORE_TO_STRING
79 void SkPaintImageFilter::toString(SkString* str) const { 76 void SkPaintImageFilter::toString(SkString* str) const {
80 str->appendf("SkPaintImageFilter: ("); 77 str->appendf("SkPaintImageFilter: (");
81 fPaint.toString(str); 78 fPaint.toString(str);
82 str->append(")"); 79 str->append(")");
83 } 80 }
84 #endif 81 #endif
OLDNEW
« no previous file with comments | « src/effects/SkOffsetImageFilter.cpp ('k') | src/effects/SkPictureImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698