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

Side by Side Diff: ui/gfx/nine_image_painter.cc

Issue 283053002: Add compositing, layers to app_list_demo Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase onto master -- probably slightly broken Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « ui/app_list/views/app_list_view.cc ('k') | ui/views/bubble/bubble_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/nine_image_painter.h" 5 #include "ui/gfx/nine_image_painter.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "third_party/skia/include/core/SkPaint.h" 9 #include "third_party/skia/include/core/SkPaint.h"
10 #include "third_party/skia/include/core/SkRect.h" 10 #include "third_party/skia/include/core/SkRect.h"
11 #include "third_party/skia/include/core/SkScalar.h" 11 #include "third_party/skia/include/core/SkScalar.h"
12 #include "ui/gfx/canvas.h" 12 #include "ui/gfx/canvas.h"
13 #include "ui/gfx/geometry/rect_conversions.h" 13 #include "ui/gfx/geometry/rect_conversions.h"
14 #include "ui/gfx/geometry/safe_integer_conversions.h" 14 #include "ui/gfx/geometry/safe_integer_conversions.h"
15 #include "ui/gfx/image/image_skia_operations.h" 15 #include "ui/gfx/image/image_skia_operations.h"
16 #include "ui/gfx/insets.h" 16 #include "ui/gfx/insets.h"
17 #include "ui/gfx/rect.h" 17 #include "ui/gfx/rect.h"
18 #include "ui/gfx/scoped_canvas.h" 18 #include "ui/gfx/scoped_canvas.h"
19 #include "ui/gfx/skia_util.h" 19 #include "ui/gfx/skia_util.h"
20 20
21 #include "base/debug/stack_trace.h"
22
21 namespace gfx { 23 namespace gfx {
22 24
23 namespace { 25 namespace {
24 26
25 // The following functions width and height of the image in pixels for the 27 // The following functions width and height of the image in pixels for the
26 // scale factor in the Canvas. 28 // scale factor in the Canvas.
27 int ImageWidthInPixels(const ImageSkia& i, Canvas* c) { 29 int ImageWidthInPixels(const ImageSkia& i, Canvas* c) {
28 return i.GetRepresentation(c->image_scale()).pixel_width(); 30 return i.GetRepresentation(c->image_scale()).pixel_width();
29 } 31 }
30 32
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 const Rect& bounds, 95 const Rect& bounds,
94 const uint8 alpha) { 96 const uint8 alpha) {
95 if (IsEmpty()) 97 if (IsEmpty())
96 return; 98 return;
97 99
98 ScopedCanvas scoped_canvas(canvas); 100 ScopedCanvas scoped_canvas(canvas);
99 canvas->Translate(bounds.OffsetFromOrigin()); 101 canvas->Translate(bounds.OffsetFromOrigin());
100 102
101 SkPaint paint; 103 SkPaint paint;
102 paint.setAlpha(alpha); 104 paint.setAlpha(alpha);
105 base::debug::StackTrace().Print();
103 106
104 // Get the current transform from the canvas and apply it to the logical 107 // Get the current transform from the canvas and apply it to the logical
105 // bounds passed in. This will give us the pixel bounds which can be used 108 // bounds passed in. This will give us the pixel bounds which can be used
106 // to draw the images at the correct locations. 109 // to draw the images at the correct locations.
107 // We should not scale the bounds by the canvas->image_scale() as that can be 110 // We should not scale the bounds by the canvas->image_scale() as that can be
108 // different from the real scale in the canvas transform. 111 // different from the real scale in the canvas transform.
109 SkMatrix matrix = canvas->sk_canvas()->getTotalMatrix(); 112 SkMatrix matrix = canvas->sk_canvas()->getTotalMatrix();
110 SkRect scaled_rect; 113 SkRect scaled_rect;
111 matrix.mapRect(&scaled_rect, RectToSkRect(bounds)); 114 matrix.mapRect(&scaled_rect, RectToSkRect(bounds));
112 115
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 scaled_height - i2h - i8h, paint); 151 scaled_height - i2h - i8h, paint);
149 canvas->DrawImageIntInPixel(images_[6], 0, 0, i6w, i6h, 0, 152 canvas->DrawImageIntInPixel(images_[6], 0, 0, i6w, i6h, 0,
150 scaled_height - i6h, i6w, i6h, false, paint); 153 scaled_height - i6h, i6w, i6h, false, paint);
151 Fill(canvas, images_[7], i6w, scaled_height - i7h, scaled_width - i6w - i8w, 154 Fill(canvas, images_[7], i6w, scaled_height - i7h, scaled_width - i6w - i8w,
152 i7h, paint); 155 i7h, paint);
153 canvas->DrawImageIntInPixel(images_[8], 0, 0, i8w, i8h, scaled_width - i8w, 156 canvas->DrawImageIntInPixel(images_[8], 0, 0, i8w, i8h, scaled_width - i8w,
154 scaled_height - i8h, i8w, i8h, false, paint); 157 scaled_height - i8h, i8w, i8h, false, paint);
155 } 158 }
156 159
157 } // namespace gfx 160 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/app_list/views/app_list_view.cc ('k') | ui/views/bubble/bubble_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698