OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/gfx/canvas.h" | 5 #include "ui/gfx/canvas.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 int width = std::max(size.width(), 1); | 577 int width = std::max(size.width(), 1); |
578 int height = std::max(size.height(), 1); | 578 int height = std::max(size.height(), 1); |
579 SkAlphaType alpha = is_opaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType; | 579 SkAlphaType alpha = is_opaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType; |
580 SkImageInfo info = SkImageInfo::MakeN32(width, height, alpha); | 580 SkImageInfo info = SkImageInfo::MakeN32(width, height, alpha); |
581 | 581 |
582 bitmap_.emplace(); | 582 bitmap_.emplace(); |
583 bitmap_->allocPixels(info); | 583 bitmap_->allocPixels(info); |
584 // Ensure that the bitmap is zeroed, since the code expects that. | 584 // Ensure that the bitmap is zeroed, since the code expects that. |
585 memset(bitmap_->getPixels(), 0, bitmap_->getSafeSize()); | 585 memset(bitmap_->getPixels(), 0, bitmap_->getSafeSize()); |
586 | 586 |
587 owned_canvas_.emplace(bitmap_.value()); | 587 owned_canvas_ = cc::SkiaPaintCanvas(bitmap_.value()); |
588 return &owned_canvas_.value(); | 588 return &owned_canvas_.value(); |
589 } | 589 } |
590 | 590 |
591 } // namespace gfx | 591 } // namespace gfx |
OLD | NEW |