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

Side by Side Diff: src/image/SkImage.cpp

Issue 153583007: Revert "Serialization of SkPictureImageFilter" (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 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/SkPictureImageFilter.cpp ('k') | tests/MatrixClipCollapseTest.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 2012 Google Inc. 2 * Copyright 2012 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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkImagePriv.h" 10 #include "SkImagePriv.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 if (NULL == rowBytes) { 48 if (NULL == rowBytes) {
49 rowBytes = &rowBytesStorage; 49 rowBytes = &rowBytesStorage;
50 } 50 }
51 return as_IB(this)->onPeekPixels(info, rowBytes); 51 return as_IB(this)->onPeekPixels(info, rowBytes);
52 } 52 }
53 53
54 bool SkImage::readPixels(SkBitmap* bitmap, const SkIRect* subset) const { 54 bool SkImage::readPixels(SkBitmap* bitmap, const SkIRect* subset) const {
55 if (NULL == bitmap) { 55 if (NULL == bitmap) {
56 return false; 56 return false;
57 } 57 }
58 58
59 SkIRect bounds = SkIRect::MakeWH(this->width(), this->height()); 59 SkIRect bounds = SkIRect::MakeWH(this->width(), this->height());
60 60
61 // trim against the bitmap, if its already been allocated 61 // trim against the bitmap, if its already been allocated
62 if (bitmap->pixelRef()) { 62 if (bitmap->pixelRef()) {
63 bounds.fRight = SkMin32(bounds.fRight, bitmap->width()); 63 bounds.fRight = SkMin32(bounds.fRight, bitmap->width());
64 bounds.fBottom = SkMin32(bounds.fBottom, bitmap->height()); 64 bounds.fBottom = SkMin32(bounds.fBottom, bitmap->height());
65 if (bounds.isEmpty()) { 65 if (bounds.isEmpty()) {
66 return false; 66 return false;
67 } 67 }
68 } 68 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 if (!tmp.allocPixels(info)) { 119 if (!tmp.allocPixels(info)) {
120 return false; 120 return false;
121 } 121 }
122 *bitmap = tmp; 122 *bitmap = tmp;
123 } 123 }
124 124
125 SkRect srcR, dstR; 125 SkRect srcR, dstR;
126 srcR.set(subset); 126 srcR.set(subset);
127 dstR = srcR; 127 dstR = srcR;
128 dstR.offset(-dstR.left(), -dstR.top()); 128 dstR.offset(-dstR.left(), -dstR.top());
129 129
130 SkCanvas canvas(*bitmap); 130 SkCanvas canvas(*bitmap);
131 131
132 SkPaint paint; 132 SkPaint paint;
133 paint.setXfermodeMode(SkXfermode::kClear_Mode); 133 paint.setXfermodeMode(SkXfermode::kClear_Mode);
134 canvas.drawRect(dstR, paint); 134 canvas.drawRect(dstR, paint);
135 135
136 const_cast<SkImage_Base*>(this)->onDrawRectToRect(&canvas, &srcR, dstR, NULL ); 136 const_cast<SkImage_Base*>(this)->onDrawRectToRect(&canvas, &srcR, dstR, NULL );
137 return true; 137 return true;
138 } 138 }
139
OLDNEW
« no previous file with comments | « src/effects/SkPictureImageFilter.cpp ('k') | tests/MatrixClipCollapseTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698