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

Side by Side Diff: ui/gfx/image/image_skia_rep.cc

Issue 854713003: More old files deletion. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fix tryjobs? Created 5 years, 11 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 | « ui/gfx/image/image_skia_rep.h ('k') | ui/gfx/image/image_skia_source.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ui/gfx/image/image_skia_rep.h"
6
7 #include "base/logging.h"
8
9 namespace gfx {
10
11 ImageSkiaRep::ImageSkiaRep() : scale_(0.0f) {
12 }
13
14 ImageSkiaRep::~ImageSkiaRep() {
15 }
16
17 ImageSkiaRep::ImageSkiaRep(const gfx::Size& size, float scale) : scale_(scale) {
18 bitmap_.allocN32Pixels(static_cast<int>(size.width() * this->scale()),
19 static_cast<int>(size.height() * this->scale()));
20 bitmap_.eraseColor(SK_ColorRED);
21 }
22
23 ImageSkiaRep::ImageSkiaRep(const SkBitmap& src, float scale)
24 : bitmap_(src),
25 scale_(scale) {
26 }
27
28 int ImageSkiaRep::GetWidth() const {
29 return static_cast<int>(bitmap_.width() / scale());
30 }
31
32 int ImageSkiaRep::GetHeight() const {
33 return static_cast<int>(bitmap_.height() / scale());
34 }
35
36 void ImageSkiaRep::SetScaled() {
37 DCHECK_EQ(0.0f, scale_);
38 if (scale_ == 0.0f)
39 scale_ = 1.0f;
40 }
41
42 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/image/image_skia_rep.h ('k') | ui/gfx/image/image_skia_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698