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

Side by Side Diff: src/pipe/utils/SamplePipeControllers.cpp

Issue 1204433002: Begin kLegacyFontHost_InitType cleanup (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add dox Created 5 years, 6 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
« no previous file with comments | « src/pipe/SkGPipeWrite.cpp ('k') | src/svg/SkSVGDevice.h » ('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 "SamplePipeControllers.h" 8 #include "SamplePipeControllers.h"
9 9
10 #include "SkBitmapDevice.h"
11 #include "SkCanvas.h" 10 #include "SkCanvas.h"
12 #include "SkGPipe.h" 11 #include "SkGPipe.h"
13 #include "SkMatrix.h" 12 #include "SkMatrix.h"
14 13
15 PipeController::PipeController(SkCanvas* target, SkPicture::InstallPixelRefProc proc) 14 PipeController::PipeController(SkCanvas* target, SkPicture::InstallPixelRefProc proc)
16 :fReader(target) { 15 :fReader(target) {
17 fBlock = NULL; 16 fBlock = NULL;
18 fBlockSize = fBytesWritten = 0; 17 fBlockSize = fBytesWritten = 0;
19 fReader.setBitmapDecoder(proc); 18 fReader.setBitmapDecoder(proc);
20 } 19 }
(...skipping 27 matching lines...) Expand all
48 int32_t bottom; 47 int32_t bottom;
49 int32_t height = bitmap.height() / NumberOfTiles; 48 int32_t height = bitmap.height() / NumberOfTiles;
50 SkIRect rect; 49 SkIRect rect;
51 for (int i = 0; i < NumberOfTiles; i++) { 50 for (int i = 0; i < NumberOfTiles; i++) {
52 bottom = i + 1 == NumberOfTiles ? bitmap.height() : top + height; 51 bottom = i + 1 == NumberOfTiles ? bitmap.height() : top + height;
53 rect.setLTRB(0, top, bitmap.width(), bottom); 52 rect.setLTRB(0, top, bitmap.width(), bottom);
54 top = bottom; 53 top = bottom;
55 54
56 SkDEBUGCODE(bool extracted = )bitmap.extractSubset(&fBitmaps[i], rect); 55 SkDEBUGCODE(bool extracted = )bitmap.extractSubset(&fBitmaps[i], rect);
57 SkASSERT(extracted); 56 SkASSERT(extracted);
58 SkBaseDevice* device = new SkBitmapDevice(fBitmaps[i]); 57 SkCanvas* canvas = new SkCanvas(fBitmaps[i]);
59 SkCanvas* canvas = new SkCanvas(device);
60 device->unref();
61 if (initial != NULL) { 58 if (initial != NULL) {
62 canvas->setMatrix(*initial); 59 canvas->setMatrix(*initial);
63 } 60 }
64 canvas->translate(SkIntToScalar(-rect.left()), 61 canvas->translate(SkIntToScalar(-rect.left()),
65 SkIntToScalar(-rect.top())); 62 SkIntToScalar(-rect.top()));
66 if (0 == i) { 63 if (0 == i) {
67 fReader.setCanvas(canvas); 64 fReader.setCanvas(canvas);
68 } else { 65 } else {
69 fReaders[i - 1].setCanvas(canvas); 66 fReaders[i - 1].setCanvas(canvas);
70 fReaders[i - 1].setBitmapDecoder(proc); 67 fReaders[i - 1].setBitmapDecoder(proc);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 void ThreadSafePipeController::draw(SkCanvas* target) { 106 void ThreadSafePipeController::draw(SkCanvas* target) {
110 SkGPipeReader reader(target); 107 SkGPipeReader reader(target);
111 for (int currentBlock = 0; currentBlock < fBlockList.count(); currentBlock++ ) { 108 for (int currentBlock = 0; currentBlock < fBlockList.count(); currentBlock++ ) {
112 reader.playback(fBlockList[currentBlock].fBlock, fBlockList[currentBlock ].fBytes); 109 reader.playback(fBlockList[currentBlock].fBlock, fBlockList[currentBlock ].fBytes);
113 } 110 }
114 111
115 if (fBlock) { 112 if (fBlock) {
116 reader.playback(fBlock, fBytesWritten); 113 reader.playback(fBlock, fBytesWritten);
117 } 114 }
118 } 115 }
OLDNEW
« no previous file with comments | « src/pipe/SkGPipeWrite.cpp ('k') | src/svg/SkSVGDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698