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

Side by Side Diff: cc/CanvasLayerTextureUpdater.cpp

Issue 10914268: Change cc files from namespace WebCore to cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 8 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 | « cc/CanvasLayerTextureUpdater.h ('k') | cc/ContentLayerChromium.h » ('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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 5
6 #include "config.h" 6 #include "config.h"
7 7
8 #if USE(ACCELERATED_COMPOSITING) 8 #if USE(ACCELERATED_COMPOSITING)
9 9
10 #include "CanvasLayerTextureUpdater.h" 10 #include "CanvasLayerTextureUpdater.h"
11 11
12 #include "CCRenderingStats.h" 12 #include "CCRenderingStats.h"
13 #include "FloatRect.h" 13 #include "FloatRect.h"
14 #include "LayerPainterChromium.h" 14 #include "LayerPainterChromium.h"
15 #include "SkCanvas.h" 15 #include "SkCanvas.h"
16 #include "SkPaint.h" 16 #include "SkPaint.h"
17 #include "SkRect.h" 17 #include "SkRect.h"
18 #include "SkiaUtils.h" 18 #include "SkiaUtils.h"
19 #include "TraceEvent.h" 19 #include "TraceEvent.h"
20 #include <wtf/CurrentTime.h> 20 #include <wtf/CurrentTime.h>
21 21
22 namespace WebCore { 22 namespace cc {
23 23
24 CanvasLayerTextureUpdater::CanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChro mium> painter) 24 CanvasLayerTextureUpdater::CanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChro mium> painter)
25 : m_painter(painter) 25 : m_painter(painter)
26 { 26 {
27 } 27 }
28 28
29 CanvasLayerTextureUpdater::~CanvasLayerTextureUpdater() 29 CanvasLayerTextureUpdater::~CanvasLayerTextureUpdater()
30 { 30 {
31 } 31 }
32 32
33 void CanvasLayerTextureUpdater::paintContents(SkCanvas* canvas, const IntRect& c ontentRect, float contentsWidthScale, float contentsHeightScale, IntRect& result ingOpaqueRect, CCRenderingStats& stats) 33 void CanvasLayerTextureUpdater::paintContents(SkCanvas* canvas, const IntRect& c ontentRect, float contentsWidthScale, float contentsHeightScale, IntRect& result ingOpaqueRect, CCRenderingStats& stats)
34 { 34 {
35 TRACE_EVENT0("cc", "CanvasLayerTextureUpdater::paintContents"); 35 TRACE_EVENT0("cc", "CanvasLayerTextureUpdater::paintContents");
36 canvas->save(); 36 canvas->save();
37 canvas->translate(WebCoreFloatToSkScalar(-contentRect.x()), WebCoreFloatToSk Scalar(-contentRect.y())); 37 canvas->translate(CCFloatToSkScalar(-contentRect.x()), CCFloatToSkScalar(-co ntentRect.y()));
38 38
39 IntRect layerRect = contentRect; 39 IntRect layerRect = contentRect;
40 40
41 if (contentsWidthScale != 1 || contentsHeightScale != 1) { 41 if (contentsWidthScale != 1 || contentsHeightScale != 1) {
42 canvas->scale(WebCoreFloatToSkScalar(contentsWidthScale), WebCoreFloatTo SkScalar(contentsHeightScale)); 42 canvas->scale(CCFloatToSkScalar(contentsWidthScale), CCFloatToSkScalar(c ontentsHeightScale));
43 43
44 FloatRect rect = contentRect; 44 FloatRect rect = contentRect;
45 rect.scale(1 / contentsWidthScale, 1 / contentsHeightScale); 45 rect.scale(1 / contentsWidthScale, 1 / contentsHeightScale);
46 layerRect = enclosingIntRect(rect); 46 layerRect = enclosingIntRect(rect);
47 } 47 }
48 48
49 SkPaint paint; 49 SkPaint paint;
50 paint.setAntiAlias(false); 50 paint.setAntiAlias(false);
51 paint.setXfermodeMode(SkXfermode::kClear_Mode); 51 paint.setXfermodeMode(SkXfermode::kClear_Mode);
52 SkRect layerSkRect = SkRect::MakeXYWH(layerRect.x(), layerRect.y(), layerRec t.width(), layerRect.height()); 52 SkRect layerSkRect = SkRect::MakeXYWH(layerRect.x(), layerRect.y(), layerRec t.width(), layerRect.height());
53 canvas->drawRect(layerSkRect, paint); 53 canvas->drawRect(layerSkRect, paint);
54 canvas->clipRect(layerSkRect); 54 canvas->clipRect(layerSkRect);
55 55
56 FloatRect opaqueLayerRect; 56 FloatRect opaqueLayerRect;
57 double paintBeginTime = monotonicallyIncreasingTime(); 57 double paintBeginTime = monotonicallyIncreasingTime();
58 m_painter->paint(canvas, layerRect, opaqueLayerRect); 58 m_painter->paint(canvas, layerRect, opaqueLayerRect);
59 stats.totalPaintTimeInSeconds += monotonicallyIncreasingTime() - paintBeginT ime; 59 stats.totalPaintTimeInSeconds += monotonicallyIncreasingTime() - paintBeginT ime;
60 canvas->restore(); 60 canvas->restore();
61 61
62 FloatRect opaqueContentRect = opaqueLayerRect; 62 FloatRect opaqueContentRect = opaqueLayerRect;
63 opaqueContentRect.scale(contentsWidthScale, contentsHeightScale); 63 opaqueContentRect.scale(contentsWidthScale, contentsHeightScale);
64 resultingOpaqueRect = enclosedIntRect(opaqueContentRect); 64 resultingOpaqueRect = enclosedIntRect(opaqueContentRect);
65 65
66 m_contentRect = contentRect; 66 m_contentRect = contentRect;
67 } 67 }
68 68
69 } // namespace WebCore 69 } // namespace cc
70 #endif // USE(ACCELERATED_COMPOSITING) 70 #endif // USE(ACCELERATED_COMPOSITING)
OLDNEW
« no previous file with comments | « cc/CanvasLayerTextureUpdater.h ('k') | cc/ContentLayerChromium.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698