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

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

Issue 23021015: Initial error handling code (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Adapting code to sk_once changes Created 7 years, 1 month 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/SkTestImageFilters.cpp ('k') | src/pipe/SkGPipeRead.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 "SkTileImageFilter.h" 8 #include "SkTileImageFilter.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
11 #include "SkDevice.h" 11 #include "SkDevice.h"
12 #include "SkFlattenableBuffers.h" 12 #include "SkFlattenableBuffers.h"
13 #include "SkMatrix.h" 13 #include "SkMatrix.h"
14 #include "SkPaint.h" 14 #include "SkPaint.h"
15 #include "SkShader.h" 15 #include "SkShader.h"
16 #include "SkValidationUtils.h"
16 17
17 bool SkTileImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src, const S kMatrix& ctm, 18 bool SkTileImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src, const S kMatrix& ctm,
18 SkBitmap* dst, SkIPoint* offset) { 19 SkBitmap* dst, SkIPoint* offset) {
19 SkBitmap source = src; 20 SkBitmap source = src;
20 SkImageFilter* input = getInput(0); 21 SkImageFilter* input = getInput(0);
21 SkIPoint localOffset = SkIPoint::Make(0, 0); 22 SkIPoint localOffset = SkIPoint::Make(0, 0);
22 if (input && !input->filterImage(proxy, src, ctm, &source, &localOffset)) { 23 if (input && !input->filterImage(proxy, src, ctm, &source, &localOffset)) {
23 return false; 24 return false;
24 } 25 }
25 26
(...skipping 23 matching lines...) Expand all
49 SkRect dstRect = fDstRect; 50 SkRect dstRect = fDstRect;
50 dstRect.offset(SkIntToScalar(localOffset.fX), SkIntToScalar(localOffset.fY)) ; 51 dstRect.offset(SkIntToScalar(localOffset.fX), SkIntToScalar(localOffset.fY)) ;
51 canvas.drawRect(dstRect, paint); 52 canvas.drawRect(dstRect, paint);
52 *dst = device->accessBitmap(false); 53 *dst = device->accessBitmap(false);
53 return true; 54 return true;
54 } 55 }
55 56
56 SkTileImageFilter::SkTileImageFilter(SkFlattenableReadBuffer& buffer) : INHERITE D(buffer) { 57 SkTileImageFilter::SkTileImageFilter(SkFlattenableReadBuffer& buffer) : INHERITE D(buffer) {
57 buffer.readRect(&fSrcRect); 58 buffer.readRect(&fSrcRect);
58 buffer.readRect(&fDstRect); 59 buffer.readRect(&fDstRect);
60 buffer.validate(SkIsValidRect(fSrcRect) && SkIsValidRect(fDstRect));
59 } 61 }
60 62
61 void SkTileImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { 63 void SkTileImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const {
62 this->INHERITED::flatten(buffer); 64 this->INHERITED::flatten(buffer);
63 buffer.writeRect(fSrcRect); 65 buffer.writeRect(fSrcRect);
64 buffer.writeRect(fDstRect); 66 buffer.writeRect(fDstRect);
65 } 67 }
OLDNEW
« no previous file with comments | « src/effects/SkTestImageFilters.cpp ('k') | src/pipe/SkGPipeRead.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698