| OLD | NEW |
| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 v8::Handle<v8::String> preserveDrawingBuffer = v8AtomicString(isolat
e, "preserveDrawingBuffer"); | 76 v8::Handle<v8::String> preserveDrawingBuffer = v8AtomicString(isolat
e, "preserveDrawingBuffer"); |
| 77 if (jsAttributes->Has(preserveDrawingBuffer) && !isUndefinedOrNull(j
sAttributes->Get(preserveDrawingBuffer))) | 77 if (jsAttributes->Has(preserveDrawingBuffer) && !isUndefinedOrNull(j
sAttributes->Get(preserveDrawingBuffer))) |
| 78 webGLAttributes->setPreserveDrawingBuffer(jsAttributes->Get(pres
erveDrawingBuffer)->BooleanValue()); | 78 webGLAttributes->setPreserveDrawingBuffer(jsAttributes->Get(pres
erveDrawingBuffer)->BooleanValue()); |
| 79 v8::Handle<v8::String> failIfMajorPerformanceCaveat = v8AtomicString
(isolate, "failIfMajorPerformanceCaveat"); | 79 v8::Handle<v8::String> failIfMajorPerformanceCaveat = v8AtomicString
(isolate, "failIfMajorPerformanceCaveat"); |
| 80 if (jsAttributes->Has(failIfMajorPerformanceCaveat) && !isUndefinedO
rNull(jsAttributes->Get(failIfMajorPerformanceCaveat))) | 80 if (jsAttributes->Has(failIfMajorPerformanceCaveat) && !isUndefinedO
rNull(jsAttributes->Get(failIfMajorPerformanceCaveat))) |
| 81 webGLAttributes->setFailIfMajorPerformanceCaveat(jsAttributes->G
et(failIfMajorPerformanceCaveat)->BooleanValue()); | 81 webGLAttributes->setFailIfMajorPerformanceCaveat(jsAttributes->G
et(failIfMajorPerformanceCaveat)->BooleanValue()); |
| 82 } | 82 } |
| 83 attributes = webGLAttributes; | 83 attributes = webGLAttributes; |
| 84 } else { | 84 } else { |
| 85 RefPtr<Canvas2DContextAttributes> canvas2DAttributes = Canvas2DContextAt
tributes::create(); | 85 RefPtr<Canvas2DContextAttributes> canvas2DAttributes = Canvas2DContextAt
tributes::create(); |
| 86 if (info.Length() > 1 && info[1]->IsObject()) { | |
| 87 v8::Handle<v8::Object> jsAttributes = info[1]->ToObject(); | |
| 88 v8::Handle<v8::String> alpha = v8AtomicString(isolate, "alpha"); | |
| 89 if (jsAttributes->Has(alpha) && !isUndefinedOrNull(jsAttributes->Get
(alpha))) | |
| 90 canvas2DAttributes->setAlpha(jsAttributes->Get(alpha)->BooleanVa
lue()); | |
| 91 } | |
| 92 attributes = canvas2DAttributes; | 86 attributes = canvas2DAttributes; |
| 93 } | 87 } |
| 94 CanvasRenderingContext* result = impl->getContext(contextId, attributes.get(
)); | 88 CanvasRenderingContext* result = impl->getContext(contextId, attributes.get(
)); |
| 95 if (!result) { | 89 if (!result) { |
| 96 v8SetReturnValueNull(info); | 90 v8SetReturnValueNull(info); |
| 97 return; | 91 return; |
| 98 } | 92 } |
| 99 if (result->is2d()) { | 93 if (result->is2d()) { |
| 100 v8::Handle<v8::Value> v8Result = toV8(toCanvasRenderingContext2D(result)
, info.Holder(), info.GetIsolate()); | 94 v8::Handle<v8::Value> v8Result = toV8(toCanvasRenderingContext2D(result)
, info.Holder(), info.GetIsolate()); |
| 101 v8SetReturnValue(info, v8Result); | 95 v8SetReturnValue(info, v8Result); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 123 quality = info[1]->NumberValue(); | 117 quality = info[1]->NumberValue(); |
| 124 qualityPtr = &quality; | 118 qualityPtr = &quality; |
| 125 } | 119 } |
| 126 | 120 |
| 127 String result = canvas->toDataURL(type, qualityPtr, exceptionState); | 121 String result = canvas->toDataURL(type, qualityPtr, exceptionState); |
| 128 exceptionState.throwIfNeeded(); | 122 exceptionState.throwIfNeeded(); |
| 129 v8SetReturnValueStringOrUndefined(info, result, info.GetIsolate()); | 123 v8SetReturnValueStringOrUndefined(info, result, info.GetIsolate()); |
| 130 } | 124 } |
| 131 | 125 |
| 132 } // namespace blink | 126 } // namespace blink |
| OLD | NEW |