OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkTestImageFilters.h" | 8 #include "SkTestImageFilters.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkDevice.h" | 10 #include "SkDevice.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // upscale | 64 // upscale |
65 { | 65 { |
66 SkBaseDevice* dev = proxy->createDevice(src.width(), src.height()); | 66 SkBaseDevice* dev = proxy->createDevice(src.width(), src.height()); |
67 if (NULL == dev) { | 67 if (NULL == dev) { |
68 return false; | 68 return false; |
69 } | 69 } |
70 OwnDeviceCanvas canvas(dev); | 70 OwnDeviceCanvas canvas(dev); |
71 | 71 |
72 SkRect r = SkRect::MakeWH(SkIntToScalar(src.width()), | 72 SkRect r = SkRect::MakeWH(SkIntToScalar(src.width()), |
73 SkIntToScalar(src.height())); | 73 SkIntToScalar(src.height())); |
74 canvas.drawBitmapRect(tmp, r); | 74 canvas.drawBitmapRect(tmp, NULL, r, NULL); |
75 *result = dev->accessBitmap(false); | 75 *result = dev->accessBitmap(false); |
76 } | 76 } |
77 return true; | 77 return true; |
78 } | 78 } |
79 | 79 |
80 SkFlattenable* SkDownSampleImageFilter::CreateProc(SkReadBuffer& buffer) { | 80 SkFlattenable* SkDownSampleImageFilter::CreateProc(SkReadBuffer& buffer) { |
81 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); | 81 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |
82 return Create(buffer.readScalar(), common.getInput(0)); | 82 return Create(buffer.readScalar(), common.getInput(0)); |
83 } | 83 } |
84 | 84 |
85 void SkDownSampleImageFilter::flatten(SkWriteBuffer& buffer) const { | 85 void SkDownSampleImageFilter::flatten(SkWriteBuffer& buffer) const { |
86 this->INHERITED::flatten(buffer); | 86 this->INHERITED::flatten(buffer); |
87 buffer.writeScalar(fScale); | 87 buffer.writeScalar(fScale); |
88 } | 88 } |
89 | 89 |
90 #ifndef SK_IGNORE_TO_STRING | 90 #ifndef SK_IGNORE_TO_STRING |
91 void SkDownSampleImageFilter::toString(SkString* str) const { | 91 void SkDownSampleImageFilter::toString(SkString* str) const { |
92 str->appendf("SkDownSampleImageFilter: ("); | 92 str->appendf("SkDownSampleImageFilter: ("); |
93 str->append(")"); | 93 str->append(")"); |
94 } | 94 } |
95 #endif | 95 #endif |
OLD | NEW |