summaryrefslogtreecommitdiffstats
path: root/cc/CCSolidColorDrawQuad.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cc/CCSolidColorDrawQuad.cpp')
-rw-r--r--cc/CCSolidColorDrawQuad.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/cc/CCSolidColorDrawQuad.cpp b/cc/CCSolidColorDrawQuad.cpp
new file mode 100644
index 0000000..26f0d8a
--- /dev/null
+++ b/cc/CCSolidColorDrawQuad.cpp
@@ -0,0 +1,32 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+
+#include "CCSolidColorDrawQuad.h"
+
+namespace WebCore {
+
+PassOwnPtr<CCSolidColorDrawQuad> CCSolidColorDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color)
+{
+ return adoptPtr(new CCSolidColorDrawQuad(sharedQuadState, quadRect, color));
+}
+
+CCSolidColorDrawQuad::CCSolidColorDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color)
+ : CCDrawQuad(sharedQuadState, CCDrawQuad::SolidColor, quadRect)
+ , m_color(color)
+{
+ if (SkColorGetA(m_color) < 255)
+ m_quadOpaque = false;
+ else
+ m_opaqueRect = quadRect;
+}
+
+const CCSolidColorDrawQuad* CCSolidColorDrawQuad::materialCast(const CCDrawQuad* quad)
+{
+ ASSERT(quad->material() == CCDrawQuad::SolidColor);
+ return static_cast<const CCSolidColorDrawQuad*>(quad);
+}
+
+}