aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/SkGpuCanvas.cpp
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2010-12-23 15:00:45 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2010-12-23 15:00:45 +0000
commit873cb1e23b64e4b2d11749352b626bcef204bdd7 (patch)
tree16749ff8667f669deb28a00bbb5a7ce6d8db8f0d /src/gpu/SkGpuCanvas.cpp
parent5b9cfd4d8809d6d55aaf047a6a8acc2de2f2eeb0 (diff)
add gpu to the default makefile
move skia-gpu files into skia/src/gpu git-svn-id: http://skia.googlecode.com/svn/trunk@653 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/SkGpuCanvas.cpp')
-rw-r--r--src/gpu/SkGpuCanvas.cpp60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/gpu/SkGpuCanvas.cpp b/src/gpu/SkGpuCanvas.cpp
new file mode 100644
index 0000000000..19bda4d943
--- /dev/null
+++ b/src/gpu/SkGpuCanvas.cpp
@@ -0,0 +1,60 @@
+/*
+ Copyright 2010 Google Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ */
+
+
+#include "GrContext.h"
+
+#include "SkGpuCanvas.h"
+#include "SkGpuDevice.h"
+
+///////////////////////////////////////////////////////////////////////////////
+
+SkGpuCanvas::SkGpuCanvas(GrContext* context) {
+ SkASSERT(context);
+ fContext = context;
+ fContext->ref();
+}
+
+SkGpuCanvas::~SkGpuCanvas() {
+ // call this now, while our override of restore() is in effect
+ this->restoreToCount(1);
+ fContext->flush(false);
+ fContext->unref();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+bool SkGpuCanvas::getViewport(SkIPoint* size) const {
+ if (size) {
+ SkDevice* device = this->getDevice();
+ if (device) {
+ size->set(device->width(), device->height());
+ } else {
+ size->set(0, 0);
+ }
+ }
+ return true;
+}
+
+SkDevice* SkGpuCanvas::createDevice(SkBitmap::Config config, int width, int height,
+ bool isOpaque, bool isLayer) {
+ SkBitmap bm;
+ bm.setConfig(config, width, height);
+ bm.setIsOpaque(isOpaque);
+ return new SkGpuDevice(this, bm, isLayer);
+}
+
+