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

Side by Side Diff: src/pipe/SkGPipeWrite.cpp

Issue 267863002: 4x allocation in PipeController is probably overkill. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: move Created 6 years, 7 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 | « no previous file | src/pipe/utils/SamplePipeControllers.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkAnnotation.h" 9 #include "SkAnnotation.h"
10 #include "SkBitmapDevice.h" 10 #include "SkBitmapDevice.h"
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 if (fDone) { 472 if (fDone) {
473 return false; 473 return false;
474 } 474 }
475 475
476 needed += 4; // size of DrawOp atom 476 needed += 4; // size of DrawOp atom
477 if (fWriter.bytesWritten() + needed > fBlockSize) { 477 if (fWriter.bytesWritten() + needed > fBlockSize) {
478 // Before we wipe out any data that has already been written, read it 478 // Before we wipe out any data that has already been written, read it
479 // out. 479 // out.
480 this->doNotify(); 480 this->doNotify();
481 size_t blockSize = SkTMax<size_t>(MIN_BLOCK_SIZE, needed); 481 size_t blockSize = SkTMax<size_t>(MIN_BLOCK_SIZE, needed);
482 blockSize += 128; // TODO(mtklein, scroggo): why do we need this extra padding?
scroggo 2014/05/02 16:15:42 Might we be passing too small a number into needOp
482 void* block = fController->requestBlock(blockSize, &fBlockSize); 483 void* block = fController->requestBlock(blockSize, &fBlockSize);
483 if (NULL == block) { 484 if (NULL == block) {
484 // Do not notify the readers, which would call this function again. 485 // Do not notify the readers, which would call this function again.
485 this->finish(false); 486 this->finish(false);
486 return false; 487 return false;
487 } 488 }
488 SkASSERT(SkIsAlign4(fBlockSize)); 489 SkASSERT(SkIsAlign4(fBlockSize));
489 fWriter.reset(block, fBlockSize); 490 fWriter.reset(block, fBlockSize);
490 fBytesNotified = 0; 491 fBytesNotified = 0;
491 } 492 }
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 return fCanvas->shuttleBitmap(bitmap, slot); 1243 return fCanvas->shuttleBitmap(bitmap, slot);
1243 } 1244 }
1244 1245
1245 void BitmapShuttle::removeCanvas() { 1246 void BitmapShuttle::removeCanvas() {
1246 if (NULL == fCanvas) { 1247 if (NULL == fCanvas) {
1247 return; 1248 return;
1248 } 1249 }
1249 fCanvas->unref(); 1250 fCanvas->unref();
1250 fCanvas = NULL; 1251 fCanvas = NULL;
1251 } 1252 }
OLDNEW
« no previous file with comments | « no previous file | src/pipe/utils/SamplePipeControllers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698