-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unify all render code in one library
Changes: * Create render library (move util/render.cpp to render/render.cpp) * Move app::Zoom class to render::Zoom * Remove doc::Image::merge() member function * Add gfx::Clip helper class (to clip dst/src rectangles before a blit) * Move doc::composite_image() to render::composite_image() * Remove doc::Sprite::render() * Replace Sprite::getPixel() with render::get_sprite_pixel() * Remove doc::layer_render() function * Convert DitheringMethod to a enum class * Add AppRender to configure a render::Render with the app configuration * Move checked background preferences as document-specific configuration * Add doc::Sprite::layer() and palette() member functions * Add doc::Layer::cel() member function * Add doc::Palette::entry() member function() * Add doc::frame_t type * Move create_palette_from_rgb/convert_pixel_format to render library * ExportSpriteSheet doesn't need a temporary image now that we can specify the source rectangle in the render routine
- Loading branch information
Showing
94 changed files
with
2,200 additions
and
1,492 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* Aseprite | ||
* Copyright (C) 2001-2014 David Capello | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
*/ | ||
|
||
#ifdef HAVE_CONFIG_H | ||
#include "config.h" | ||
#endif | ||
|
||
#include "app/app_render.h" | ||
|
||
#include "app/app.h" | ||
#include "app/color_utils.h" | ||
#include "app/pref/preferences.h" | ||
#include "render/render.h" | ||
|
||
namespace app { | ||
|
||
AppRender::AppRender() | ||
{ | ||
} | ||
|
||
AppRender::AppRender(app::Document* doc, doc::PixelFormat pixelFormat) | ||
{ | ||
setupBackground(doc, pixelFormat); | ||
} | ||
|
||
void AppRender::setupBackground(app::Document* doc, doc::PixelFormat pixelFormat) | ||
{ | ||
DocumentPreferences& docPref = App::instance()->preferences().document(doc); | ||
render::BgType bgType; | ||
|
||
gfx::Size tile; | ||
switch (docPref.bg.type()) { | ||
case app::gen::BgType::CHECKED_16x16: | ||
bgType = render::BgType::CHECKED; | ||
tile = gfx::Size(16, 16); | ||
break; | ||
case app::gen::BgType::CHECKED_8x8: | ||
bgType = render::BgType::CHECKED; | ||
tile = gfx::Size(8, 8); | ||
break; | ||
case app::gen::BgType::CHECKED_4x4: | ||
bgType = render::BgType::CHECKED; | ||
tile = gfx::Size(4, 4); | ||
break; | ||
case app::gen::BgType::CHECKED_2x2: | ||
bgType = render::BgType::CHECKED; | ||
tile = gfx::Size(2, 2); | ||
break; | ||
default: | ||
bgType = render::BgType::TRANSPARENT; | ||
break; | ||
} | ||
|
||
setBgType(bgType); | ||
setBgZoom(docPref.bg.zoom()); | ||
setBgColor1(color_utils::color_for_image(docPref.bg.color1(), pixelFormat)); | ||
setBgColor2(color_utils::color_for_image(docPref.bg.color2(), pixelFormat)); | ||
setBgCheckedSize(tile); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.