OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "gfx/canvas_direct2d.h" | 5 #include "ui/gfx/canvas_direct2d.h" |
6 | 6 |
7 #include "base/scoped_ptr.h" | 7 #include "base/scoped_ptr.h" |
8 #include "gfx/brush.h" | 8 #include "ui/gfx/brush.h" |
9 #include "gfx/rect.h" | 9 #include "ui/gfx/rect.h" |
10 | 10 |
11 namespace { | 11 namespace { |
12 | 12 |
13 // Converts a SkColor to a ColorF. | 13 // Converts a SkColor to a ColorF. |
14 D2D1_COLOR_F SkColorToColorF(SkColor color) { | 14 D2D1_COLOR_F SkColorToColorF(SkColor color) { |
15 return D2D1::ColorF(static_cast<float>(SkColorGetR(color)) / 0xFF, | 15 return D2D1::ColorF(static_cast<float>(SkColorGetR(color)) / 0xFF, |
16 static_cast<float>(SkColorGetG(color)) / 0xFF, | 16 static_cast<float>(SkColorGetG(color)) / 0xFF, |
17 static_cast<float>(SkColorGetB(color)) / 0xFF, | 17 static_cast<float>(SkColorGetB(color)) / 0xFF, |
18 static_cast<float>(SkColorGetA(color)) / 0xFF); | 18 static_cast<float>(SkColorGetA(color)) / 0xFF); |
19 } | 19 } |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 // CanvasDirect2D, private: | 353 // CanvasDirect2D, private: |
354 | 354 |
355 void CanvasDirect2D::SaveInternal(ID2D1Layer* layer) { | 355 void CanvasDirect2D::SaveInternal(ID2D1Layer* layer) { |
356 if (!drawing_state_block_) | 356 if (!drawing_state_block_) |
357 GetD2D1Factory()->CreateDrawingStateBlock(drawing_state_block_.Receive()); | 357 GetD2D1Factory()->CreateDrawingStateBlock(drawing_state_block_.Receive()); |
358 rt_->SaveDrawingState(drawing_state_block_.get()); | 358 rt_->SaveDrawingState(drawing_state_block_.get()); |
359 state_.push(RenderState(layer)); | 359 state_.push(RenderState(layer)); |
360 } | 360 } |
361 | 361 |
362 } // namespace gfx | 362 } // namespace gfx |
OLD | NEW |