| 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 "picture_utils.h" | 8 #include "picture_utils.h" |
| 9 #include "CopyTilesRenderer.h" | 9 #include "CopyTilesRenderer.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| 11 #include "SkDevice.h" | 11 #include "SkDevice.h" |
| 12 #include "SkImageEncoder.h" | 12 #include "SkImageEncoder.h" |
| 13 #include "SkPicture.h" | 13 #include "SkPicture.h" |
| 14 #include "SkPixelRef.h" | 14 #include "SkPixelRef.h" |
| 15 #include "SkRect.h" | 15 #include "SkRect.h" |
| 16 #include "SkString.h" | 16 #include "SkString.h" |
| 17 | 17 |
| 18 namespace sk_tools { | 18 namespace sk_tools { |
| 19 #if SK_SUPPORT_GPU |
| 20 CopyTilesRenderer::CopyTilesRenderer(const GrContext::Options& opts, int x,
int y) |
| 21 : INHERITED(opts) |
| 22 , fXTilesPerLargeTile(x) |
| 23 , fYTilesPerLargeTile(y) { } |
| 24 #else |
| 19 CopyTilesRenderer::CopyTilesRenderer(int x, int y) | 25 CopyTilesRenderer::CopyTilesRenderer(int x, int y) |
| 20 : fXTilesPerLargeTile(x) | 26 : fXTilesPerLargeTile(x) |
| 21 , fYTilesPerLargeTile(y) { | 27 , fYTilesPerLargeTile(y) { } |
| 22 } | 28 #endif |
| 23 void CopyTilesRenderer::init(const SkPicture* pict, const SkString* writePat
h, | 29 void CopyTilesRenderer::init(const SkPicture* pict, const SkString* writePat
h, |
| 24 const SkString* mismatchPath, const SkString* i
nputFilename, | 30 const SkString* mismatchPath, const SkString* i
nputFilename, |
| 25 bool useChecksumBasedFilenames) { | 31 bool useChecksumBasedFilenames) { |
| 26 // Do not call INHERITED::init(), which would create a (potentially larg
e) canvas which is | 32 // Do not call INHERITED::init(), which would create a (potentially larg
e) canvas which is |
| 27 // not used by bench_pictures. | 33 // not used by bench_pictures. |
| 28 SkASSERT(pict != NULL); | 34 SkASSERT(pict != NULL); |
| 29 // Only work with absolute widths (as opposed to percentages). | 35 // Only work with absolute widths (as opposed to percentages). |
| 30 SkASSERT(this->getTileWidth() != 0 && this->getTileHeight() != 0); | 36 SkASSERT(this->getTileWidth() != 0 && this->getTileHeight() != 0); |
| 31 fPicture.reset(pict)->ref(); | 37 fPicture.reset(pict)->ref(); |
| 32 this->CopyString(&fWritePath, writePath); | 38 this->CopyString(&fWritePath, writePath); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 } | 99 } |
| 94 } | 100 } |
| 95 } | 101 } |
| 96 return success; | 102 return success; |
| 97 } | 103 } |
| 98 | 104 |
| 99 SkString CopyTilesRenderer::getConfigNameInternal() { | 105 SkString CopyTilesRenderer::getConfigNameInternal() { |
| 100 return SkString("copy_tiles"); | 106 return SkString("copy_tiles"); |
| 101 } | 107 } |
| 102 } | 108 } |
| OLD | NEW |