OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkBitmapDevice.h" | 8 #include "SkBitmapDevice.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkCanvasPriv.h" | 10 #include "SkCanvasPriv.h" |
(...skipping 3117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3128 | 3128 |
3129 sk_sp<SkImage> povDepthMap; | 3129 sk_sp<SkImage> povDepthMap; |
3130 sk_sp<SkImage> diffuseMap; | 3130 sk_sp<SkImage> diffuseMap; |
3131 | 3131 |
3132 // TODO: pass the depth to the shader in vertices, or uniforms | 3132 // TODO: pass the depth to the shader in vertices, or uniforms |
3133 // so we don't have to render depth and color separately | 3133 // so we don't have to render depth and color separately |
3134 | 3134 |
3135 // povDepthMap | 3135 // povDepthMap |
3136 { | 3136 { |
3137 SkLights::Builder builder; | 3137 SkLights::Builder builder; |
3138 builder.add(SkLights::Light(SkColor3f::Make(1.0f, 1.0f, 1.0f), | 3138 builder.add(SkLights::Light::MakeDirectional(SkColor3f::Make(1.0f, 1.0f,
1.0f), |
3139 SkVector3::Make(0.0f, 0.0f, 1.0f))); | 3139 SkVector3::Make(0.0f, 0.0f,
1.0f))); |
3140 sk_sp<SkLights> povLight = builder.finish(); | 3140 sk_sp<SkLights> povLight = builder.finish(); |
3141 | 3141 |
3142 SkImageInfo info = SkImageInfo::Make(picture->cullRect().width(), | 3142 SkImageInfo info = SkImageInfo::Make(picture->cullRect().width(), |
3143 picture->cullRect().height(), | 3143 picture->cullRect().height(), |
3144 kBGRA_8888_SkColorType, | 3144 kBGRA_8888_SkColorType, |
3145 kOpaque_SkAlphaType); | 3145 kOpaque_SkAlphaType); |
3146 | 3146 |
3147 // Create a new surface (that matches the backend of canvas) | 3147 // Create a new surface (that matches the backend of canvas) |
3148 // to create the povDepthMap | 3148 // to create the povDepthMap |
3149 sk_sp<SkSurface> surf(this->makeSurface(info)); | 3149 sk_sp<SkSurface> surf(this->makeSurface(info)); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3296 | 3296 |
3297 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { | 3297 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { |
3298 fCanvas->restoreToCount(fSaveCount); | 3298 fCanvas->restoreToCount(fSaveCount); |
3299 } | 3299 } |
3300 | 3300 |
3301 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API | 3301 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API |
3302 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p
rops) { | 3302 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p
rops) { |
3303 return this->makeSurface(info, props).release(); | 3303 return this->makeSurface(info, props).release(); |
3304 } | 3304 } |
3305 #endif | 3305 #endif |
OLD | NEW |