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

Side by Side Diff: Source/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp

Issue 17230006: Implement WEBGL_shared_resources Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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 | « no previous file | Source/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007-2009 Google Inc. All rights reserved. 2 * Copyright (C) 2007-2009 Google Inc. All rights reserved.
3 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 3 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 17 matching lines...) Expand all
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32 #include "config.h" 32 #include "config.h"
33 #include "V8HTMLCanvasElement.h" 33 #include "V8HTMLCanvasElement.h"
34 34
35 #include "V8CanvasRenderingContext2D.h" 35 #include "V8CanvasRenderingContext2D.h"
36 #include "V8Node.h" 36 #include "V8Node.h"
37 #include "V8WebGLRenderingContext.h" 37 #include "V8WebGLRenderingContext.h"
38 #include "V8WebGLShareGroup.h"
38 #include "bindings/v8/V8Binding.h" 39 #include "bindings/v8/V8Binding.h"
39 #include "core/html/HTMLCanvasElement.h" 40 #include "core/html/HTMLCanvasElement.h"
40 #include "core/html/canvas/Canvas2DContextAttributes.h" 41 #include "core/html/canvas/Canvas2DContextAttributes.h"
41 #include "core/html/canvas/CanvasRenderingContext.h" 42 #include "core/html/canvas/CanvasRenderingContext.h"
42 #include "core/html/canvas/WebGLContextAttributes.h" 43 #include "core/html/canvas/WebGLContextAttributes.h"
43 #include "core/inspector/InspectorCanvasInstrumentation.h" 44 #include "core/inspector/InspectorCanvasInstrumentation.h"
44 #include "wtf/MathExtras.h" 45 #include "wtf/MathExtras.h"
45 #include "wtf/text/WTFString.h" 46 #include "wtf/text/WTFString.h"
46 47
47 namespace WebCore { 48 namespace WebCore {
(...skipping 19 matching lines...) Expand all
67 webGLAttrs->setStencil(jsAttrs->Get(stencil)->BooleanValue()); 68 webGLAttrs->setStencil(jsAttrs->Get(stencil)->BooleanValue());
68 v8::Handle<v8::String> antialias = v8::String::NewSymbol("antialias" ); 69 v8::Handle<v8::String> antialias = v8::String::NewSymbol("antialias" );
69 if (jsAttrs->Has(antialias)) 70 if (jsAttrs->Has(antialias))
70 webGLAttrs->setAntialias(jsAttrs->Get(antialias)->BooleanValue() ); 71 webGLAttrs->setAntialias(jsAttrs->Get(antialias)->BooleanValue() );
71 v8::Handle<v8::String> premultipliedAlpha = v8::String::NewSymbol("p remultipliedAlpha"); 72 v8::Handle<v8::String> premultipliedAlpha = v8::String::NewSymbol("p remultipliedAlpha");
72 if (jsAttrs->Has(premultipliedAlpha)) 73 if (jsAttrs->Has(premultipliedAlpha))
73 webGLAttrs->setPremultipliedAlpha(jsAttrs->Get(premultipliedAlph a)->BooleanValue()); 74 webGLAttrs->setPremultipliedAlpha(jsAttrs->Get(premultipliedAlph a)->BooleanValue());
74 v8::Handle<v8::String> preserveDrawingBuffer = v8::String::NewSymbol ("preserveDrawingBuffer"); 75 v8::Handle<v8::String> preserveDrawingBuffer = v8::String::NewSymbol ("preserveDrawingBuffer");
75 if (jsAttrs->Has(preserveDrawingBuffer)) 76 if (jsAttrs->Has(preserveDrawingBuffer))
76 webGLAttrs->setPreserveDrawingBuffer(jsAttrs->Get(preserveDrawin gBuffer)->BooleanValue()); 77 webGLAttrs->setPreserveDrawingBuffer(jsAttrs->Get(preserveDrawin gBuffer)->BooleanValue());
78 v8::Handle<v8::String> group = v8::String::NewSymbol("group");
79 if (jsAttrs->Has(group)) {
80 v8::Handle<v8::Value> value = jsAttrs->Get(group);
81 if (value->IsObject()) {
82 webGLAttrs->setGroup(V8WebGLShareGroup::toNative(value->ToOb ject()));
83 }
84 }
77 } 85 }
78 attrs = webGLAttrs; 86 attrs = webGLAttrs;
79 } else { 87 } else {
80 RefPtr<Canvas2DContextAttributes> canvas2DAttrs = Canvas2DContextAttribu tes::create(); 88 RefPtr<Canvas2DContextAttributes> canvas2DAttrs = Canvas2DContextAttribu tes::create();
81 if (args.Length() > 1 && args[1]->IsObject()) { 89 if (args.Length() > 1 && args[1]->IsObject()) {
82 v8::Handle<v8::Object> jsAttrs = args[1]->ToObject(); 90 v8::Handle<v8::Object> jsAttrs = args[1]->ToObject();
83 v8::Handle<v8::String> alpha = v8::String::NewSymbol("alpha"); 91 v8::Handle<v8::String> alpha = v8::String::NewSymbol("alpha");
84 if (jsAttrs->Has(alpha)) 92 if (jsAttrs->Has(alpha))
85 canvas2DAttrs->setAlpha(jsAttrs->Get(alpha)->BooleanValue()); 93 canvas2DAttrs->setAlpha(jsAttrs->Get(alpha)->BooleanValue());
86 } 94 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 quality = args[1]->NumberValue(); 144 quality = args[1]->NumberValue();
137 qualityPtr = &quality; 145 qualityPtr = &quality;
138 } 146 }
139 147
140 String result = canvas->toDataURL(type, qualityPtr, ec); 148 String result = canvas->toDataURL(type, qualityPtr, ec);
141 setDOMException(ec, args.GetIsolate()); 149 setDOMException(ec, args.GetIsolate());
142 v8SetReturnValue(args, v8StringOrUndefined(result, args.GetIsolate())); 150 v8SetReturnValue(args, v8StringOrUndefined(result, args.GetIsolate()));
143 } 151 }
144 152
145 } // namespace WebCore 153 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698