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

Side by Side Diff: cc/CanvasLayerTextureUpdater.cpp

Issue 11122003: [cc] Rename all cc/ filenames to Chromium style (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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
(Empty)
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
3 // found in the LICENSE file.
4
5
6 #include "config.h"
7
8 #if USE(ACCELERATED_COMPOSITING)
9
10 #include "CanvasLayerTextureUpdater.h"
11
12 #include "CCRenderingStats.h"
13 #include "FloatRect.h"
14 #include "LayerPainterChromium.h"
15 #include "SkCanvas.h"
16 #include "SkPaint.h"
17 #include "SkRect.h"
18 #include "SkiaUtils.h"
19 #include "TraceEvent.h"
20 #include <wtf/CurrentTime.h>
21
22 namespace cc {
23
24 CanvasLayerTextureUpdater::CanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChro mium> painter)
25 : m_painter(painter)
26 {
27 }
28
29 CanvasLayerTextureUpdater::~CanvasLayerTextureUpdater()
30 {
31 }
32
33 void CanvasLayerTextureUpdater::paintContents(SkCanvas* canvas, const IntRect& c ontentRect, float contentsWidthScale, float contentsHeightScale, IntRect& result ingOpaqueRect, CCRenderingStats& stats)
34 {
35 TRACE_EVENT0("cc", "CanvasLayerTextureUpdater::paintContents");
36 canvas->save();
37 canvas->translate(CCFloatToSkScalar(-contentRect.x()), CCFloatToSkScalar(-co ntentRect.y()));
38
39 IntRect layerRect = contentRect;
40
41 if (contentsWidthScale != 1 || contentsHeightScale != 1) {
42 canvas->scale(CCFloatToSkScalar(contentsWidthScale), CCFloatToSkScalar(c ontentsHeightScale));
43
44 FloatRect rect = contentRect;
45 rect.scale(1 / contentsWidthScale, 1 / contentsHeightScale);
46 layerRect = enclosingIntRect(rect);
47 }
48
49 SkPaint paint;
50 paint.setAntiAlias(false);
51 paint.setXfermodeMode(SkXfermode::kClear_Mode);
52 SkRect layerSkRect = SkRect::MakeXYWH(layerRect.x(), layerRect.y(), layerRec t.width(), layerRect.height());
53 canvas->drawRect(layerSkRect, paint);
54 canvas->clipRect(layerSkRect);
55
56 FloatRect opaqueLayerRect;
57 double paintBeginTime = monotonicallyIncreasingTime();
58 m_painter->paint(canvas, layerRect, opaqueLayerRect);
59 stats.totalPaintTimeInSeconds += monotonicallyIncreasingTime() - paintBeginT ime;
60 canvas->restore();
61
62 FloatRect opaqueContentRect = opaqueLayerRect;
63 opaqueContentRect.scale(contentsWidthScale, contentsHeightScale);
64 resultingOpaqueRect = enclosedIntRect(opaqueContentRect);
65
66 m_contentRect = contentRect;
67 }
68
69 } // namespace cc
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