| OLD | NEW |
| 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 "PictureRenderer.h" | 8 #include "PictureRenderer.h" |
| 9 #include "picture_utils.h" | 9 #include "picture_utils.h" |
| 10 #include "SamplePipeControllers.h" | 10 #include "SamplePipeControllers.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 canvas = SkNEW_ARGS(SkCanvas, (device.get())); | 171 canvas = SkNEW_ARGS(SkCanvas, (device.get())); |
| 172 break; | 172 break; |
| 173 } | 173 } |
| 174 #endif | 174 #endif |
| 175 default: | 175 default: |
| 176 SkASSERT(0); | 176 SkASSERT(0); |
| 177 return NULL; | 177 return NULL; |
| 178 } | 178 } |
| 179 setUpFilter(canvas, fDrawFilters); | 179 setUpFilter(canvas, fDrawFilters); |
| 180 this->scaleToScaleFactor(canvas); | 180 this->scaleToScaleFactor(canvas); |
| 181 |
| 182 // Pictures often lie about their extent (i.e., claim to be 100x100 but |
| 183 // only ever draw to 90x100). Clear here so the undrawn portion will have |
| 184 // a consistent color |
| 185 canvas->clear(SK_ColorTRANSPARENT); |
| 181 return canvas; | 186 return canvas; |
| 182 } | 187 } |
| 183 | 188 |
| 184 void PictureRenderer::scaleToScaleFactor(SkCanvas* canvas) { | 189 void PictureRenderer::scaleToScaleFactor(SkCanvas* canvas) { |
| 185 SkASSERT(canvas != NULL); | 190 SkASSERT(canvas != NULL); |
| 186 if (fScaleFactor != SK_Scalar1) { | 191 if (fScaleFactor != SK_Scalar1) { |
| 187 canvas->scale(fScaleFactor, fScaleFactor); | 192 canvas->scale(fScaleFactor, fScaleFactor); |
| 188 } | 193 } |
| 189 } | 194 } |
| 190 | 195 |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 virtual SkString getConfigNameInternal() SK_OVERRIDE { | 947 virtual SkString getConfigNameInternal() SK_OVERRIDE { |
| 943 return SkString("picture_clone"); | 948 return SkString("picture_clone"); |
| 944 } | 949 } |
| 945 }; | 950 }; |
| 946 | 951 |
| 947 PictureRenderer* CreatePictureCloneRenderer() { | 952 PictureRenderer* CreatePictureCloneRenderer() { |
| 948 return SkNEW(PictureCloneRenderer); | 953 return SkNEW(PictureCloneRenderer); |
| 949 } | 954 } |
| 950 | 955 |
| 951 } // namespace sk_tools | 956 } // namespace sk_tools |
| OLD | NEW |