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

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

Issue 1078113002: Add serialization of SkBitmapSource's new filterQuality member variable (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Added SKP version number comment Created 5 years, 8 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
« src/core/SkReadBuffer.h ('K') | « src/core/SkReadBuffer.h ('k') | no next file » | 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 The Android Open Source Project 2 * Copyright 2012 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 "SkBitmapSource.h" 8 #include "SkBitmapSource.h"
9 #include "SkDevice.h" 9 #include "SkDevice.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 14 matching lines...) Expand all
25 const SkRect& srcRect, const SkRect& dstRect, 25 const SkRect& srcRect, const SkRect& dstRect,
26 SkFilterQuality filterQuality) 26 SkFilterQuality filterQuality)
27 : INHERITED(0, 0) 27 : INHERITED(0, 0)
28 , fBitmap(bitmap) 28 , fBitmap(bitmap)
29 , fSrcRect(srcRect) 29 , fSrcRect(srcRect)
30 , fDstRect(dstRect) 30 , fDstRect(dstRect)
31 , fFilterQuality(filterQuality) { 31 , fFilterQuality(filterQuality) {
32 } 32 }
33 33
34 SkFlattenable* SkBitmapSource::CreateProc(SkReadBuffer& buffer) { 34 SkFlattenable* SkBitmapSource::CreateProc(SkReadBuffer& buffer) {
35 SkFilterQuality filterQuality;
36 if (buffer.isVersionLT(SkReadBuffer::kBitmapourceFilterQuality_Version)) {
37 filterQuality = kHigh_SkFilterQuality;
38 } else {
39 filterQuality = (SkFilterQuality)buffer.readInt();
40 }
35 SkRect src, dst; 41 SkRect src, dst;
36 buffer.readRect(&src); 42 buffer.readRect(&src);
37 buffer.readRect(&dst); 43 buffer.readRect(&dst);
38 SkBitmap bitmap; 44 SkBitmap bitmap;
39 if (!buffer.readBitmap(&bitmap)) { 45 if (!buffer.readBitmap(&bitmap)) {
40 return NULL; 46 return NULL;
41 } 47 }
42 return SkBitmapSource::Create(bitmap, src, dst); 48 return SkBitmapSource::Create(bitmap, src, dst, filterQuality);
43 } 49 }
44 50
45 void SkBitmapSource::flatten(SkWriteBuffer& buffer) const { 51 void SkBitmapSource::flatten(SkWriteBuffer& buffer) const {
52 buffer.writeInt(fFilterQuality);
46 buffer.writeRect(fSrcRect); 53 buffer.writeRect(fSrcRect);
47 buffer.writeRect(fDstRect); 54 buffer.writeRect(fDstRect);
48 buffer.writeBitmap(fBitmap); 55 buffer.writeBitmap(fBitmap);
49 } 56 }
50 57
51 bool SkBitmapSource::onFilterImage(Proxy* proxy, const SkBitmap&, const Context& ctx, 58 bool SkBitmapSource::onFilterImage(Proxy* proxy, const SkBitmap&, const Context& ctx,
52 SkBitmap* result, SkIPoint* offset) const { 59 SkBitmap* result, SkIPoint* offset) const {
53 SkRect bounds, dstRect; 60 SkRect bounds, dstRect;
54 fBitmap.getBounds(&bounds); 61 fBitmap.getBounds(&bounds);
55 ctx.ctm().mapRect(&dstRect, fDstRect); 62 ctx.ctm().mapRect(&dstRect, fDstRect);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 void SkBitmapSource::toString(SkString* str) const { 101 void SkBitmapSource::toString(SkString* str) const {
95 str->appendf("SkBitmapSource: ("); 102 str->appendf("SkBitmapSource: (");
96 str->appendf("src: (%f,%f,%f,%f) dst: (%f,%f,%f,%f) ", 103 str->appendf("src: (%f,%f,%f,%f) dst: (%f,%f,%f,%f) ",
97 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto m, 104 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto m,
98 fDstRect.fLeft, fDstRect.fTop, fDstRect.fRight, fDstRect.fBotto m); 105 fDstRect.fLeft, fDstRect.fTop, fDstRect.fRight, fDstRect.fBotto m);
99 str->appendf("bitmap: (%d,%d)", 106 str->appendf("bitmap: (%d,%d)",
100 fBitmap.width(), fBitmap.height()); 107 fBitmap.width(), fBitmap.height());
101 str->append(")"); 108 str->append(")");
102 } 109 }
103 #endif 110 #endif
OLDNEW
« src/core/SkReadBuffer.h ('K') | « src/core/SkReadBuffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698