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

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

Issue 26702002: force readbuffer clients to use specialized readFoo for flattenables (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/effects/SkColorFilterImageFilter.cpp ('k') | src/effects/SkXfermodeImageFilter.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 2013 Google Inc. 2 * Copyright 2013 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 "SkRectShaderImageFilter.h" 8 #include "SkRectShaderImageFilter.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 27 matching lines...) Expand all
38 38
39 SkRectShaderImageFilter::SkRectShaderImageFilter(SkShader* s, const CropRect* cr opRect) 39 SkRectShaderImageFilter::SkRectShaderImageFilter(SkShader* s, const CropRect* cr opRect)
40 : INHERITED(NULL, cropRect) 40 : INHERITED(NULL, cropRect)
41 , fShader(s) { 41 , fShader(s) {
42 SkASSERT(s); 42 SkASSERT(s);
43 s->ref(); 43 s->ref();
44 } 44 }
45 45
46 SkRectShaderImageFilter::SkRectShaderImageFilter(SkFlattenableReadBuffer& buffer ) 46 SkRectShaderImageFilter::SkRectShaderImageFilter(SkFlattenableReadBuffer& buffer )
47 : INHERITED(buffer) { 47 : INHERITED(buffer) {
48 fShader = buffer.readFlattenableT<SkShader>(); 48 fShader = buffer.readShader();
49 } 49 }
50 50
51 void SkRectShaderImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { 51 void SkRectShaderImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const {
52 this->INHERITED::flatten(buffer); 52 this->INHERITED::flatten(buffer);
53 53
54 buffer.writeFlattenable(fShader); 54 buffer.writeFlattenable(fShader);
55 } 55 }
56 56
57 SkRectShaderImageFilter::~SkRectShaderImageFilter() { 57 SkRectShaderImageFilter::~SkRectShaderImageFilter() {
58 SkSafeUnref(fShader); 58 SkSafeUnref(fShader);
(...skipping 18 matching lines...) Expand all
77 SkMatrix matrix; 77 SkMatrix matrix;
78 matrix.setTranslate(-SkIntToScalar(bounds.fLeft), -SkIntToScalar(bounds.fTop )); 78 matrix.setTranslate(-SkIntToScalar(bounds.fLeft), -SkIntToScalar(bounds.fTop ));
79 fShader->setLocalMatrix(matrix); 79 fShader->setLocalMatrix(matrix);
80 SkRect rect = SkRect::MakeWH(SkIntToScalar(bounds.width()), SkIntToScalar(bo unds.height())); 80 SkRect rect = SkRect::MakeWH(SkIntToScalar(bounds.width()), SkIntToScalar(bo unds.height()));
81 canvas.drawRect(rect, paint); 81 canvas.drawRect(rect, paint);
82 *result = device.get()->accessBitmap(false); 82 *result = device.get()->accessBitmap(false);
83 offset->fX += bounds.fLeft; 83 offset->fX += bounds.fLeft;
84 offset->fY += bounds.fTop; 84 offset->fY += bounds.fTop;
85 return true; 85 return true;
86 } 86 }
OLDNEW
« no previous file with comments | « src/effects/SkColorFilterImageFilter.cpp ('k') | src/effects/SkXfermodeImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698