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

Side by Side Diff: src/core/SkCanvas.cpp

Issue 472123002: simplify SkCanvas::init() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 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 | no next file » | 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 2008 The Android Open Source Project 2 * Copyright 2008 The Android Open Source Project
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 8
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkCanvasPriv.h" 10 #include "SkCanvasPriv.h"
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 378
379 #define LOOPER_END } 379 #define LOOPER_END }
380 380
381 //////////////////////////////////////////////////////////////////////////// 381 ////////////////////////////////////////////////////////////////////////////
382 382
383 SkBaseDevice* SkCanvas::init(SkBaseDevice* device) { 383 SkBaseDevice* SkCanvas::init(SkBaseDevice* device) {
384 fCachedLocalClipBounds.setEmpty(); 384 fCachedLocalClipBounds.setEmpty();
385 fCachedLocalClipBoundsDirty = true; 385 fCachedLocalClipBoundsDirty = true;
386 fAllowSoftClip = true; 386 fAllowSoftClip = true;
387 fAllowSimplifyClip = false; 387 fAllowSimplifyClip = false;
388 fDeviceCMDirty = false; 388 fDeviceCMDirty = true;
389 fSaveLayerCount = 0; 389 fSaveLayerCount = 0;
390 fCullCount = 0; 390 fCullCount = 0;
391 fMetaData = NULL; 391 fMetaData = NULL;
392 392
393 fMCRec = (MCRec*)fMCStack.push_back(); 393 fMCRec = (MCRec*)fMCStack.push_back();
394 new (fMCRec) MCRec(NULL); 394 new (fMCRec) MCRec(NULL);
395 395
396 fMCRec->fLayer = SkNEW_ARGS(DeviceCM, (NULL, 0, 0, NULL, NULL)); 396 fMCRec->fLayer = SkNEW_ARGS(DeviceCM, (NULL, 0, 0, NULL, NULL));
397 fMCRec->fTopLayer = fMCRec->fLayer; 397 fMCRec->fTopLayer = fMCRec->fLayer;
398 398
399 fSurfaceBase = NULL; 399 fSurfaceBase = NULL;
400 400
401 return this->setRootDevice(device); 401 if (device) {
402 device->onAttachToCanvas(this);
403 fMCRec->fLayer->fDevice = SkRef(device);
404 fMCRec->fRasterClip.setRect(SkIRect::MakeWH(device->width(), device->hei ght()));
405 }
406 return device;
402 } 407 }
403 408
404 SkCanvas::SkCanvas() 409 SkCanvas::SkCanvas()
405 : fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage)) 410 : fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage))
406 { 411 {
407 inc_canvas(); 412 inc_canvas();
408 413
409 this->init(NULL); 414 this->init(NULL);
410 } 415 }
411 416
(...skipping 2141 matching lines...) Expand 10 before | Expand all | Expand 10 after
2553 } 2558 }
2554 2559
2555 if (NULL != matrix) { 2560 if (NULL != matrix) {
2556 canvas->concat(*matrix); 2561 canvas->concat(*matrix);
2557 } 2562 }
2558 } 2563 }
2559 2564
2560 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 2565 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
2561 fCanvas->restoreToCount(fSaveCount); 2566 fCanvas->restoreToCount(fSaveCount);
2562 } 2567 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698